This example shows the ability for the report globalization. The report can be localized in multiple cultures. This is an important feature for international projects, which provides an opportunity to overcome the language barrier. In other words, the same report can be displayed in different languages.
The
button2_Click
method allows you to choose the culture and apply it to the report. For example, apply to the report France, Germany, Italy, Russia, Spain, Inited Kingdom and United States cultures. Use
GlobalizationManager
to select the culture:
private void button2_Click(object sender, System.EventArgs e)
{
if (cbCountry.Text.Length == 0)
{
cbCountry.Focus();
MessageBox.Show("Please, select country.");
}
else
{
#region Switch Culture
string cultureName = "";
switch (cbCountry.Text)
{
case "France":
cultureName = "fr-FR";
break;
case "Germany":
cultureName = "de-DE";
break;
case "Italy":
cultureName = "it-IT";
break;
case "Russia":
cultureName = "ru-RU";
break;
case "Spain":
cultureName = "es-ES";
break;
case "United Kingdom":
cultureName = "en-GB";
break;
case "United States":
cultureName = "en-US";
break;
}
#endregion
StiReport report = new StiReport();
// Set globalization
report.GlobalizationManager = new GlobalizationManager("GlobalizedReports.MyResources",
new CultureInfo(cultureName));
report.RegData(dataSet1);
report.Load("..\\GlobalizedSimpleList.mrt");
report.Show();
}
}
In the screenshot below you can see the result of the sample code: