This example shows how the report globalization works. 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 various languages.

For example, we added several language files to the list:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Globalized_Reports.Default" %>
<%@ Register assembly="Stimulsoft.Report.Web" namespace="Stimulsoft.Report.Web" tagprefix="cc1" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
	<title>Globalizad Reports</title>
</head>
<body>
	<form id="form1" runat="server">
	<div>
		<asp:Label ID="Label1" runat="server" Font-Names="Arial" Font-Size="14px" Text="Select Country"></asp:Label>
		<br />
		<asp:DropDownList ID="DropDownList1" runat="server" Width="150">
			<asp:ListItem Value="fr-FR">France</asp:ListItem>
			<asp:ListItem Value="de-DE">Germany</asp:ListItem>
			<asp:ListItem Value="it-IT">Italy</asp:ListItem>
			<asp:ListItem Value="ru-RU">Russia</asp:ListItem>
			<asp:ListItem Value="es-ES">Spain</asp:ListItem>
			<asp:ListItem Value="en-GB">United Kingdom</asp:ListItem>
			<asp:ListItem Value="en-US">United States</asp:ListItem>
		</asp:DropDownList>
		<br />
		<br />
		<asp:Button ID="Button1" runat="server" Text="View Report" onclick="Button1_Click" />
		<br />
		<br />
		<cc1:StiWebViewer ID="StiWebViewer1" runat="server" />
	</div>
	</form>
</body>
</html>

The Page_Load() event applies the selected culture to the report. For this purpose the GlobalizationManager class is used:
protected void Page_Load(object sender, EventArgs e)
{
	// Apply Localization to WebViewer
	var locFile = DropDownList1.SelectedValue.Substring(0, 2);
	StiWebViewer1.Localization = $"\\Localization\\{locFile}.xml";

	// Get Report
	var report = new StiReport();
	report.Load(Server.MapPath("\\Reports\\SimpleList.mrt"));
	report.GlobalizationManager = new GlobalizationManager(new CultureInfo(DropDownList1.SelectedValue));

	// Get Report Data
	var data = new DataSet();
	data.ReadXml(Server.MapPath("\\Data\\Demo.xml"));
	report.RegData(data);

	// Assign Report
	StiWebViewer1.Report = report;
}

Auf dem Screenshot unten Sie können das Ergebnis des Beispiel-Codes ansehen:

Globalizing Reports

By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.