Class TextObjectBase
Base class for text objects such as TextObject and
Inheritance
Implements
Inherited Members
Namespace: FastReport
Assembly: FastReport.Base.dll
Syntax
public class TextObjectBase : BreakableComponent, IFRSerializable
Remarks
This class implements common functionality of the text objects.
Constructors
TextObjectBase()
Initializes a new instance of the TextObjectBase class with default settings.
Declaration
public TextObjectBase()
Properties
AllowExpressions
Gets or sets a value indicating that the object's text may contain expressions.
Declaration
public bool AllowExpressions { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Brackets
Gets or sets the symbols that will be used to find expressions in the object's text.
Declaration
public string Brackets { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The default property value is "[,]". As you can see, the open and close symbols are separated by the comma. You may use another symbols, for example: "<,>" or "<%,%>". You should use different open and close symbols.
Duplicates
Gets or sets a value that determines how to display duplicate values.
Declaration
public Duplicates Duplicates { get; set; }
Property Value
Type | Description |
---|---|
Duplicates |
Editable
Gets or sets editable for pdf export
Declaration
public bool Editable { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Format
Gets or sets the formatter that will be used to format data in the Text object.
Declaration
public FormatBase Format { get; set; }
Property Value
Type | Description |
---|---|
FormatBase |
Remarks
The default formatter does nothing, i.e. it shows expression values with no formatting. To set another formatting, create a new formatter and assign it to this property.
If there are several expressions in the text, use the Formats property to format each expression value.
Examples
This example shows how to set currency formatter.
TextObject text1;
text1.Format = new CurrencyFormat();
Formats
Gets the collection of formatters.
Declaration
public FormatCollection Formats { get; }
Property Value
Type | Description |
---|---|
FormatCollection |
Remarks
This property is used to set format for each expression contained in the text. For example, if the TextObject contains two expressions:
Today is [Date]; Page [PageN]
you can use the following code to format these expressions separately:
text1.Formats.Clear();
text1.Formats.Add(new DateFormat());
text1.Formats.Add(new NumberFormat());
HideValue
Gets or sets a value that will be hidden.
Declaration
public string HideValue { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Use this property to specify a value that you would like to hide. For example, specify "0" if you want to hide zero values, or use HideZeros property to do this.
You also may use this property to hide default DateTime values (such as 1/1/1900). In this case you need to specify a string containing both date and time, for example: "1/1/1900 0:00:00".
caution
FastReport uses the ToString conversion to compare the expression value with this property. This conversion depends on regional settings selected in the Control Panel, so be aware of this if you going to distribute your report worldwide.
HideZeros
Gets or sets a value indicating that zero values must be hidden.
Declaration
public bool HideZeros { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
NullValue
Gets or sets a string that will be displayed instead of a null value.
Declaration
public string NullValue { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Padding
Gets or sets padding within the text object.
Declaration
public Padding Padding { get; set; }
Property Value
Type | Description |
---|---|
Padding |
ProcessAt
Gets or sets a value that specifies how the report engine processes this text object.
Declaration
public ProcessAt ProcessAt { get; set; }
Property Value
Type | Description |
---|---|
ProcessAt |
Remarks
Use this property to perform such task as "print a total value in the group header". Normally, all total values are calculated in the footers (for example, in a group footer). If you try to print a total value in the group header, you will get 0. If you set this property to ProcessAt.DataFinished, FastReport will do the following:
- print the object (with wrong value);
- print all related data rows;
- calculate the correct object's value and replace old (wrong) value with the new one.
caution
This option will not work if you set the FastReport.Report.UseFileCache to true.
Text
Gets or sets the object's text.
Declaration
public virtual string Text { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
Text may contain expressions and data items, for example: "Today is [Date]". When report is running, all expressions are calculated and replaced with actual values, so the text would be "Today is 01.01.2008".
Value
Gets a value of expression contained in the object's text.
Declaration
public object Value { get; }
Property Value
Type | Description |
---|---|
System.Object |
Methods
Assign(Base)
Declaration
public override void Assign(Base source)
Parameters
Type | Name | Description |
---|---|---|
Base | source |
Overrides
DeserializeSubItems(FRReader)
Declaration
protected override void DeserializeSubItems(FRReader reader)
Parameters
Type | Name | Description |
---|---|---|
FRReader | reader |
Overrides
ExtractMacros()
Declaration
public override void ExtractMacros()
Overrides
GetDisplayText()
Returns the text to display.
Declaration
public virtual string GetDisplayText()
Returns
Type | Description |
---|---|
System.String | The text to display. |
Remarks
This method is used to display simplified DB field names in the designer. In runtime, it returns the Text property value.
Serialize(FRWriter)
Declaration
public override void Serialize(FRWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FRWriter | writer |