Sdílet prostřednictvím


Formatting Numbers and Dates (Report Builder 2.0)

You can format numbers and dates in data regions by selecting a format from the Number page of the corresponding data region's Properties dialog box.

To specify format strings within a text box report item, you need to select the item that you want to format, right-click, select Text Box Properties, and then click Number. This approach can also be used to format individual cells in the Tablix data region because cells in a Table or Matrix data region are individual text boxes.

A Chart data region is commonly used to show dates along the category (x) axis, and values along the value (y) axis. To specify formatting in a Chart, right-click an axis and select Axis Properties. On the value axis, you can specify formats only for numbers. For more information, see Formatting Axis Labels on a Chart (Report Builder 2.0).

To specify formatting in a Gauge data region, right-click the scale of the gauge and select Radial Scale Properties or Linear Scale Properties.

Considerations for Formatting Numbers and Dates

Before you format numbers and dates in your report, you should consider the following:

  • By default, numbers are formatted to reflect the cultural settings on the client computer. Use formatting strings to specify how numbers are displayed so that formatting is consistent regardless of where the person who is viewing the report is located.

  • The formats provided on the Number page are a subset of the .NET Framework standard numeric format strings. To format a number or date using a custom format that is not shown in the dialog box, you can use any .NET Framework format strings for numbers or dates. For more information about custom format strings, see the Formatting Types topic on MSDN.

  • If a custom format string has been specified, it has a higher priority over default settings that are culture-specific. For example, suppose you set a custom format string of "#,###" to show the number 1234 as 1,234. This may have different meaning to users in the United States than it does to users in Europe. Before you specify a custom format, consider how the format you choose will affect users of different cultures who may view the report.

  • If you specify an invalid format string, the formatted text is interpreted as a literal string which overrides the formatting.

  • If you are formatting a mix of numbers and characters in the same text box, consider using a placeholder to format the number separately from the rest of the text. For more information, see Formatting Text and Importing HTML (Report Builder 2.0). If an invalid format string is specified for the Format property on the text box, the format string is ignored. If an invalid format string is specified for the Format property on the chart or gauge, the format string that you specified is interpreted as a string and formatting is not applied.