Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Collapse]Reporting
 [Expand]Product Information
 [Expand]Getting Started
 [Expand]Fundamental Concepts
 [Collapse]Concepts
  [Expand]Report Types
  [Expand]Report Controls
  [Expand]Platform-Specific Reporting
  [Collapse]Creating Reports
   [Expand]Providing Data to Reports
   [Expand]Providing Data To Report Controls
   [Collapse]Shaping Data
     Grouping Data
     Sorting Data
     Filtering Data
     Calculating Summaries
     Formatting Data
   [Expand]Using Report Parameters
   [Expand]Appearance Customization
   [Expand]Navigation and Interaction
   [Expand]Scripting
  [Expand]Storing Reports
  [Expand]Publishing Reports
  [Expand]End-User Reporting
  [Expand]Application Appearance
  [Expand]Migration to XtraReports
 [Expand]Design-Time Features
 [Expand]Examples
  End-User Capabilities
 [Expand]Localization
 [Expand]Redistribution and Deployment
 [Expand]API Reference
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
[Expand]End-User Documentation

Formatting Data

This document describes how to format data in XtraReports. We define formatting as the presentation format of a control's incoming data. Primarily, it's required to format date-time, currency, percent and number data.

With XtraReports, you can apply one (or both) of the following formats to your data.

Expanded Apply the .NET Format

Basic Formatting

It is possible to apply formatting only to values bound to a control's properties, and not to the controls' static content.

For example, to format an XRLabel's XRControl.Text value, use the XRBinding.FormatString property. At design time, click the ellipsis button for this property to invoke the FormatString Editor, containing numerous built-in formatting presets, grouped by categories.

In this dialog, choose the required preset or specify a custom format, and click OK. For a step-by-step tutorial, refer to How to: Format Data.

In a similar way, for the XRLabel control, you can also apply formatting to the XRControl.NavigateUrl (for example, to add the https:// prefix to the link's contents), XRControl.Tag and XRControl.Bookmark properties. And, the set of bindable properties varies with the control type.

Note

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

To process such values, use the XRControl.NullValueText and XRControl.ProcessNullValues properties.

Formatting Summaries

Note that the XRSummary object has its own XRSummary.FormatString property, as the following image demonstrates. For details on this, refer to Calculating Summaries.

Mail-Merge Formatting

When creating a mail-merge report, you can define the format string for the embedded data field, by separating it from the data field name with the ! symbol.

For a step-by-step tutorial, refer to How to: Create a Mail Merge Report.

Expanded 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 treated as the format string by Excel®, if the XlExportOptionsBase.TextExportMode property is set to Value.

If the XRControl.XlsxFormatString property isn't set to any value, the .NET format string (if it is specified) is applied to the control's content, instead.

Note

If 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. So, if both formats are specified for a control, the XLSX format is used when a document is exported to the XLSX format.

To learn more, refer to Export to XLSX.Exporting.

Expanded See Also

How would you rate this topic?​​​​​​​