Class RepString
Represents a string object for a single-line text in a PDF report, where the dimensions are in points.
public class RepString : RepObject
- Inheritance
-
RepString
- Derived
- Inherited Members
Examples
StandardFontDef fontDef = new(StandardFont.Helvetica);
FontProp font = new(fontDef, 10);
RepString rs = new(font, "abcdefghijklmn", 50, TextOptions.EllipsisIfTooLong);
Result: abcdefg…
Constructors
RepString(FontProp, string)
Initializes a new instance of the RepString class with the specified font and text.
public RepString(FontProp font, string text)
Parameters
Exceptions
- ArgumentNullException
The font or text is null.
RepString(FontProp, string, double, TextOptions)
Initializes a new instance of the RepString class with the specified font, text, maximum width and text options.
public RepString(FontProp font, string text, double widthMax, TextOptions options = TextOptions.SmallerFontIfToolLong)
Parameters
font
FontPropThe font for the string.
text
stringThe single-line text.
widthMax
doubleThe maximum width of the string in points.
options
TextOptionsThe text options for the string. The default value is SmallerFontIfToolLong.
Remarks
Supported text options:
TextOption | Description |
---|---|
TruncateIfTooLong | If the text is longer than the specified width, it is truncated. |
EllipsisIfTooLong | If the text is longer than the specified width, it is truncated by ellipsis. |
SmallerFontIfToolLong | If the text is longer than the specified width, the font is scaled down. |
Exceptions
- ArgumentNullException
The font or text is null.
- ArgumentException
Invalid option:
None
,Center
,Right
orAdjustWidth
or more than one of [TruncateIfTooLong
,EllipsisIfTooLong
,SmallerFontIfToolLong
] are not allowed.
Properties
BBox
Gets the bounding box of the report object.
public override Rect BBox { get; }
Property Value
Font
Gets the font of the string object.
public FontProp Font { get; }
Property Value
- FontProp
The font, not nullable.
Height
Gets the height of the report object.
public override double Height { get; }
Property Value
Options
Gets the text options for the string.
public TextOptions Options { get; }
Property Value
- TextOptions
The text options.
Text
Gets the text of the string object.
public string Text { get; }
Property Value
- string
The text, not nullable.
Width
Gets the width of the report object.
public override double Width { get; }