翻譯|使用教程|編輯:王香|2018-10-19 10:48:06.000|閱讀 416 次
概述:此示例項目演示了如何本地化視圖。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
此示例項目顯示了如何本地化HTML5查看器。選擇本地化足以將本地化名稱或本地化XML文件的路徑設置為Localization屬性的值。這可以在ASPX頁面或Page_Load事件中完成。
<cc1:StiWebViewer ID="StiWebViewer1" runat="server" Localization="en" />
StiWebViewer1.Localization = "en"; ... StiWebViewer1.Localization = "Localization/en.xml";
在下面的示例中,我們添加了本地化列表。所有XML文件都位于Web項目的Localization文件夾中。選擇后,您可以顯示具有指定本地化的查看器。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Localizing_the_Viewer.Default" %> <!DOCTYPE html> <html xmlns="//www.w3.org/1999/xhtml"> <head runat="server"> <title>Localizing the Viewer</title> </head> <body> <form id="form1" runat="server"> <div> <h2><span style="color: #0066ff">Localizing Viewer Example</span></h2> <h3>This sample demonstrates how to localize the report viewer</h3> <asp:DropDownList ID="DropDownListLang" runat="server"> <asp:ListItem Value="ar">Arabic</asp:ListItem> <asp:ListItem Value="be">Belarusian</asp:ListItem> <asp:ListItem Value="bg">Bulgarian</asp:ListItem> <asp:ListItem Value="ca-ES">Catalan</asp:ListItem> <asp:ListItem Value="cs">Czech</asp:ListItem> <asp:ListItem Value="de">Deutsch</asp:ListItem> <asp:ListItem Value="el-GR">Greek</asp:ListItem> <asp:ListItem Value="en-GB">English (UK)</asp:ListItem> <asp:ListItem Value="en" Selected="True">English</asp:ListItem> <asp:ListItem Value="es">Spanish</asp:ListItem> <asp:ListItem Value="eu-ES">Basque</asp:ListItem> <asp:ListItem Value="fa">Farsi</asp:ListItem> <asp:ListItem Value="fr">French</asp:ListItem> <asp:ListItem Value="gl-ES">Galician</asp:ListItem> <asp:ListItem Value="hr">Croatian</asp:ListItem> <asp:ListItem Value="hu">Hungarian</asp:ListItem> <asp:ListItem Value="id">Indonesian</asp:ListItem> <asp:ListItem Value="it">Italian</asp:ListItem> <asp:ListItem Value="ka">Georgian</asp:ListItem> <asp:ListItem Value="Lt-sr-SP">Serbian (Latin)</asp:ListItem> <asp:ListItem Value="lt">Lithuanian</asp:ListItem> <asp:ListItem Value="nb-NO">Norwegian (Bokmål)</asp:ListItem> <asp:ListItem Value="nl">Dutch</asp:ListItem> <asp:ListItem Value="pl">Polish</asp:ListItem> <asp:ListItem Value="pt-BR">Portugese (Brazil)</asp:ListItem> <asp:ListItem Value="pt">Portuguese</asp:ListItem> <asp:ListItem Value="ro">Romanian</asp:ListItem> <asp:ListItem Value="ru">Russian</asp:ListItem> <asp:ListItem Value="sk">Slovak</asp:ListItem> <asp:ListItem Value="sv">Swedish</asp:ListItem> <asp:ListItem Value="tr">Turkish</asp:ListItem> <asp:ListItem Value="ua">Ukrainian</asp:ListItem> <asp:ListItem Value="zh-CHS">Chinese (Simplified)</asp:ListItem> <asp:ListItem Value="zh-CHT">Chinese (Traditional)</asp:ListItem> </asp:DropDownList> <asp:Button ID="ButtonShowReport" runat="server" Text="Show Report" onclick="ButtonShowReport_Click" /> </div> </form> </body> </html>
該ButtonShowReport_Click事件重定向到Report.aspx頁面。在此頁面上,在Page_Load事件中為其加載報表和數據,然后將選定的本地化應用于查看器。
protected void Page_Load(object sender, EventArgs e) { StiReport report = new StiReport(); DataSet data = new DataSet(); report.Load(Server.MapPath(@"Reports\Invoice.mrt")); report.Compile(); data.ReadXml(Server.MapPath(@"Data\Demo.xml")); report.RegData(data); StiWebViewer1.Localization = String.Format("Localization/{0}.xml", (string)Session["lang"]); StiWebViewer1.Report = report; }
示例代碼的結果如下圖所示:
購買Stimulsoft正版授權,請點擊“”喲!
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn