Show / Hide Table of Contents

Class TextObjectBase

Base class for text objects such as TextObject and .

Inheritance
System.Object
Base
ComponentBase
ReportComponentBase
BreakableComponent
TextObjectBase
HtmlObject
TextObject
Implements
IFRSerializable
Inherited Members
BreakableComponent.CanBreak
BreakableComponent.BreakTo
BreakableComponent.Break(BreakableComponent)
ReportComponentBase.BeforePrint
ReportComponentBase.AfterPrint
ReportComponentBase.AfterData
ReportComponentBase.Click
ReportComponentBase.Exportable
ReportComponentBase.Border
ReportComponentBase.Fill
ReportComponentBase.FillColor
ReportComponentBase.Bookmark
ReportComponentBase.Hyperlink
ReportComponentBase.CanGrow
ReportComponentBase.CanShrink
ReportComponentBase.GrowToBottom
ReportComponentBase.ShiftMode
ReportComponentBase.Style
ReportComponentBase.EvenStyle
ReportComponentBase.HoverStyle
ReportComponentBase.EvenStylePriority
ReportComponentBase.PrintOn
ReportComponentBase.BeforePrintEvent
ReportComponentBase.AfterPrintEvent
ReportComponentBase.AfterDataEvent
ReportComponentBase.ClickEvent
ReportComponentBase.FlagSimpleBorder
ReportComponentBase.FlagUseBorder
ReportComponentBase.FlagUseFill
ReportComponentBase.FlagPreviewVisible
ReportComponentBase.FlagSerializeStyle
ReportComponentBase.FlagProvidesHyperlinkValue
ReportComponentBase.Cursor
ReportComponentBase.MouseMoveEvent
ReportComponentBase.MouseUpEvent
ReportComponentBase.MouseDownEvent
ReportComponentBase.MouseEnterEvent
ReportComponentBase.MouseLeaveEvent
ReportComponentBase.ApplyStyle(Style)
ReportComponentBase.SaveStyle()
ReportComponentBase.RestoreStyle()
ReportComponentBase.DrawBackground(FRPaintEventArgs)
ReportComponentBase.Draw(FRPaintEventArgs)
ReportComponentBase.IsVisible(FRPaintEventArgs)
ReportComponentBase.Deserialize(FRReader)
ReportComponentBase.OnClick(EventArgs)
ReportComponentBase.OnAfterLoad()
ReportComponentBase.HasClickListeners()
ReportComponentBase.InitializeComponent()
ReportComponentBase.FinalizeComponent()
ReportComponentBase.SaveState()
ReportComponentBase.RestoreState()
ReportComponentBase.CalcHeight()
ReportComponentBase.GetData()
ReportComponentBase.GetExpressions()
ReportComponentBase.OnBeforePrint(EventArgs)
ReportComponentBase.OnAfterPrint(EventArgs)
ReportComponentBase.OnAfterData(EventArgs)
ComponentBase.AbsBottom
ComponentBase.AbsBounds
ComponentBase.AbsLeft
ComponentBase.AbsRight
ComponentBase.AbsTop
ComponentBase.Anchor
ComponentBase.Bottom
ComponentBase.Bounds
ComponentBase.ClientSize
ComponentBase.Dock
ComponentBase.GroupIndex
ComponentBase.Height
ComponentBase.Left
ComponentBase.Right
ComponentBase.Tag
ComponentBase.Top
ComponentBase.Visible
ComponentBase.Printable
ComponentBase.Width
Base.Name
Base.Restrictions
Base.Flags
Base.Parent
Base.BaseName
Base.ClassName
Base.Report
Base.Page
Base.ChildObjects
Base.AllObjects
Base.ZOrder
Base.IsAncestor
Base.IsDesigning
Base.IsPrinting
Base.IsRunning
Base.OriginalComponent
Base.SetProp(Base, Base)
Base.FloatDiff(Single, Single)
Base.ExtractDefaultMacros(String)
Base.Dispose(Boolean)
Base.SetFlags(Flags, Boolean)
Base.SetReport(Report)
Base.SetName(String)
Base.SetParent(Base)
Base.SetParentCore(Base)
Base.FindObject(String)
Base.CreateUniqueName()
Base.Clear()
Base.BaseAssign(Base)
Base.AssignAll(Base)
Base.HasParent(Base)
Base.HasFlag(Flags)
Base.HasRestriction(Restrictions)
Base.InvokeEvent(String, Object)
Base.GetCustomScript()
Base.IsHaveToConvert(Object)
Base.GetConvertedObjects()
Base.ForEachAllConvectedObjects(Object)
Namespace: FastReport
Assembly: FastReport.OpenSource.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 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)

Copies the contents of another, similar object.

Declaration
public override void Assign(Base source)
Parameters
Type Name Description
Base source

Source object to copy the contents from.

Overrides
BreakableComponent.Assign(Base)
Remarks

Call Assign to copy the properties from another object of the same type. The standard form of a call to Assign is

destination.Assign(source);

which tells the destination object to copy the contents of the source object to itself. In this method, all child objects are ignored. If you want to copy child objects, use the AssignAll(Base) method.

See Also
AssignAll(Base)

DeserializeSubItems(FRReader)

Deserializes nested object properties.

Declaration
protected override void DeserializeSubItems(FRReader reader)
Parameters
Type Name Description
FRReader reader

Reader object.

Overrides
Base.DeserializeSubItems(FRReader)
Remarks

Typically the object serializes all properties to the single xml item:

<TextObject Name="Text2" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>

Some objects like DataBand have child objects that serialized in subitems:

<DataBand Name="Data1" Top="163" Width="718.2" Height="18.9">
  <TextObject Name="Text3" Left="18.9" Top="37.8" Width="283.5" Height="28.35"/>
</DataBand>

To read such subitems, the DeserializeSubItems method is used. Base implementation reads the child objects. You may override it to read some specific subitems.

ExtractMacros()

Used to extract macros such as "TotalPages#" in the preview mode.

Declaration
public override void ExtractMacros()
Overrides
Base.ExtractMacros()
Remarks

This method is used mainly by the TextObject to extract macros and replace it with actual values passed in the pageIndex and totalPages parameters. This method is called automatically when the object is being previewed.

Serialize(FRWriter)

Serializes the object.

Declaration
public override void Serialize(FRWriter writer)
Parameters
Type Name Description
FRWriter writer

Writer object.

Overrides
BreakableComponent.Serialize(FRWriter)
Remarks

Do not call this method directly. You should override it if you are developing a new component for FastReport.

This method is called when the object needs to save the state. It may happen when:

  • saving the report to the file or stream;
  • saving the report to the designer's undo buffer;
  • assigning the object to another object using the Assign(Base) or AssignAll(Base) methods;
  • saving the object to the designer's clipboard;
  • saving the object to the preview (when run a report).

Implements

IFRSerializable
Back to top Generated by DocFX