- 18 Sep 2024
- 1 Minute to read
- DarkLight
Localization
- Updated on 18 Sep 2024
- 1 Minute to read
- DarkLight
General
The following report types support localization to ensure that date and number formats are applied using a specific culture:
When Microsoft Excel Reports are used to export to a Microsoft Excel Workbook, localization will not be applied, because Microsoft Excel displays dates and numbers always in accordance with the regional settings of the user opening the workbook (i.e. the same workbook being opened on two different computers with two different regional settings will lead to different date and number formats to be displayed). Culture settings of Microsoft Excel Reports will therefore only be applied when creating a PDF document from the workbook.
Setting Culture
The culture to be applied when formatting numbers and dates can either be set by setting the Culture Name property of the report in the Report Designer or by adding an Activate Culture Action to the preparation actions of the report. In both cases you need to write an Expression that returns a String that contains the name of the culture to be applied, which needs to be one of the values of the CultureInfo Code column of the Culture Code List.
Numbers in the report document will automatically be formatted using the specified culture (e.g. if the culture name is en-US then numbers in the report will be formatted using a comma as thousands separator and a point as a decimal separator).
In order to have dates formatted using the current culture, the Format function needs to be used; let's say you have an expression element in your report that contains the following expression:
Format(Date.Today, "d")
This will format the current date using the d Format String which represents a short date pattern for the currently applicable culture. If the culture has been set to en-US it will use the MM/dd/yyyy pattern, if it has been set to de-AT it will use the dd.MM.yyyy pattern etc.