xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xtrareport-dot-applylocalization-x28-system-dot-string-x29.md
Applies values contained in the localized report for the specified locale.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
public void ApplyLocalization(
string culture
)
Public Sub ApplyLocalization(
culture As String
)
| Name | Type | Description |
|---|---|---|
| culture | String |
A culture name. Use a specific culture (e.g., en-US) to maintain currency, number and date format consistency.
|
The method is used for localized reports and allows you to create a document in the locale that differs from the current thread culture.
Note
Use a specific culture (e.g., de-CH) as the method parameter. If you specify a neutral culture (a two-letter lowercase language code), the currency, date and number formats are also set for the neutral culture (which is not what you expect to see).
Call the method before the XtraReport.CreateDocument method to specify the language to be applied to the new document.
using System.Windows.Forms;
using DevExpress.XtraReports.UI;
using System.Threading;
// ...
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
XtraReport localizedReport = new LocalizedReport1();
localizedReport.ApplyLocalization("de-DE");
localizedReport.CreateDocument();
// The document is in German
Imports System.Windows.Forms
Imports DevExpress.XtraReports.UI
Imports System.Threading
' ...
Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
Dim localizedReport As XtraReport = New LocalizedReport1()
localizedReport.ApplyLocalization("de-DE")
localizedReport.CreateDocument()
' The document is in German
Note
If you call the ApplyLocalization method after the CreateDocument method, the document that was already created retains its language. In this case the ApplyLocalization method has no effect.
As an alternative, you may call the ApplyLocalization method in the BeforePrint handler to specify the language to be applied to the new document:
using DevExpress.XtraReports.UI;
using System.Threading;
// ...
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
XtraReport localizedReport = new LocalizedReport1();
localizedReport.BeforePrint += (s, e) =>
{
localizedReport.ApplyLocalization("de-DE");
};
localizedReport.CreateDocument();
// The document is in German
Imports DevExpress.XtraReports.UI
Imports System.Threading
' ...
Thread.CurrentThread.CurrentCulture = New CultureInfo("en-US")
Dim localizedReport As XtraReport = New LocalizedReport1()
AddHandler localizedReport.BeforePrint, Sub(s, e)
localizedReport.ApplyLocalization("de-DE")
End Sub
localizedReport.CreateDocument()
' The document is in German
Report Parameters
Culture-Specific Format Strings
See Also