Xceed Grid for WinForms v4.3 Documentation
TextFormat Property (HeaderFooterElement)


Xceed.Grid.Reporting.v4.3 Assembly > Xceed.Grid.Reporting Namespace > HeaderFooterElement Class : TextFormat Property
Gets or sets a string used to dynamically create the HeaderFooterElement's text.
Syntax
'Declaration
 
<DescriptionAttribute("A string used to dynamically create the header or footer element's text. Use DATETIME to print current date, PAGE to print page number and TOTALPAGES to print the total number of pages.")>
<CategoryAttribute("Appearance")>
<LocalizableAttribute(True)>
<DefaultValueAttribute("")>
<EndUserDisplayNameAttribute("Text")>
Public Property TextFormat As String
'Usage
 
Dim instance As HeaderFooterElement
Dim value As String
 
instance.TextFormat = value
 
value = instance.TextFormat
[Description("A string used to dynamically create the header or footer element's text. Use DATETIME to print current date, PAGE to print page number and TOTALPAGES to print the total number of pages.")]
[Category("Appearance")]
[Localizable(true)]
[DefaultValue("")]
[EndUserDisplayName("Text")]
public string TextFormat {get; set;}

Property Value

A string used to dynamically create the HeaderFooterElement's text. By default, "".

The following table provides a list of the supported variables and their definitions.

Supported variables Descriptions
%PAGE[ format=["]format_specifier["] ]% The current page.
%TOTALPAGES[ format=format_specifier]% The total number of pages.
%DATETIME[ format=["]format_specifier["] ]% The current date and time. By default, the system short date pattern will be used.
%TITLE[ format=["]format_specifier["] ]% The title of the report.

All items placed in square brackets [] are optional. If the format_specifier contains spaces, then quotes must be used.

In addition to the default variables, custom variables can be provided through the ReportSettings.CustomVariables property. The string representation of the default variables as well as the custom ones can be modified during the QueryVariableText event.

The following example demonstrates how to set the TextFormat property to display the current date.

Dim report As New Report( GridControl1 )
report.ReportStyleSheet.PageHeader.LeftElement.TextFormat = "The current date is: %DATETIME format=""dd MMM yy""%"
report.PrintPreview()

Report report = new Report( gridControl1 );
report.ReportStyleSheet.PageHeader.LeftElement.TextFormat = "The current date is: %DATETIME format=\"dd MMM yy\"%";
report.PrintPreview();
Remarks

The HeaderFooterElement's text will be displayed over its image.

The DATETIME variable will only be evaluated once at the beginning. All other variables will be evaluated for each page.

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

HeaderFooterElement Class
HeaderFooterElement Members