Table of Contents

Class RepString

Namespace
Root.ReportNet.Pdf
Assembly
ReportNet.dll

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

font FontProp

The font for the string.

text string

The single-line text.

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 FontProp

The font for the string.

text string

The single-line text.

widthMax double

The maximum width of the string in points.

options TextOptions

The text options for the string. The default value is SmallerFontIfToolLong.

Remarks

Supported text options:

TextOptionDescription
TruncateIfTooLongIf the text is longer than the specified width, it is truncated.
EllipsisIfTooLongIf the text is longer than the specified width, it is truncated by ellipsis.
SmallerFontIfToolLongIf 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 or AdjustWidth 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

Rect

The bounding box as a Rect object, not nullable (struct).

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

double

The height as a double 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; }

Property Value

double

The width as a double value.

See Also