Skip to main content
A newer version of this page is available. .

Format Data

  • 2 minutes to read

This document describes how to format data in a report by applying a .NET format to it.

HowTo - FormatData_4

Note

This approach to formatting data applies when the UserDesignerOptions.DataBindingMode is set to DataBindingMode.Bindings.

When using this mode, you can only apply formatting to values bound to a control’s properties, and not to the controls’ static content.

See Format Data to learn how to format a report’s data when this property is set to DataBindingMode.Expressions or DataBindingMode.ExpressionsAdvanced.

See Data Binding Modes to learn more about the available binding modes.

Format Data-Bound Controls

  1. Select a data-bound report control to which to apply a format string and click its smart tag. Click the XRBinding.FormatString property’s ellipsis button, and in the invoked FormatString Editor, choose the required formatting by selecting one of the built-in patterns or entering a custom format string.

    HowTo - FormatData_1

  2. When using mail-merge to make a label display both static and dynamic data, you can add a format to the label’s dynamic contents by separating it from the data field name with the ! symbol.

    bindings-format-mail-merge-date-time

Note

The XRBinding.FormatString setting is ignored for Null, DBNull and String.Empty values.

Use the XRControl.NullValueText and XRControl.ProcessNullValues properties to process such values.

Format Summaries

Select a label with an assigned summary function, click its smart tag and specify the Format String property.

HowTo - FormatData_3

Apply the Native XLSX Format

In addition to a .NET format string, you can also apply a native XLSX format to an XRLabel‘s or XRTableCell‘s content using its XRControl.XlsxFormatString property. A value assigned to this property is converted to a native Excel format string when exporting the report to XLSX if the XlExportOptionsBase.TextExportMode property is set to Value.

FormattingData_2

When the XRControl.XlsxFormatString property is not set to any value, the specified .NET format string is applied to the control’s content.

When the XlExportOptionsBase.TextExportMode property is set to Text, all control content is exported as plain text with no formatting applied.

Note

The XLSX format has priority over the .NET format. When both formats are specified for a control, the XLSX format is used when a document is exported to XLSX format.

See Export to XLSX for more information.