翻譯|使用教程|編輯:王香|2018-10-09 10:19:27.000|閱讀 398 次
概述:本文介紹了在Stimulsoft Reports.Net中利用代碼實現全球化語言報表。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
【下載Stimulsoft Reports.Net最新版本】
此示例顯示報表全球化的工作原理,該報表可以在多種文化中進行本地化。這是國際項目的一個重要特征,它提供了克服語言障礙的機會,可以用各種語言顯示相同的報表。 例如,我們在列表中添加了幾個語言文件。
<%@ 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="//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>
該button1_Click事件所選擇的文化應用到報表。為此,使用GlobalizationManager類。
protected void Button1_Click(object sender, EventArgs e) { string appPath = Server.MapPath(string.Empty); string cultureName = DropDownList1.SelectedValue; // Get Report Data DataSet data = new DataSet(); data.ReadXml(appPath + "\\Data\\Demo.xml"); // Get Report StiReport report = new StiReport(); report.GlobalizationManager = new GlobalizationManager(new CultureInfo(cultureName)); report.RegData(data); report.Load(appPath + "\\Data\\SimpleList.mrt"); // Show Report StiWebViewer1.Report = report; }
示例代碼的結果如下圖所示:
購買Stimulsoft正版授權,請點擊“”喲!
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn