翻譯|使用教程|編輯:王香|2018-09-29 10:14:44.000|閱讀 395 次
概述:本文主要介紹了Stimulsoft報表中如何使用組件屬性自定義Web查看器,可以更改查看器元素的顏色,隱藏隱藏不必要的按鈕或菜單項,設置控件的默認狀態,更改Web查看器的某些行為。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
【下載Stimulsoft Reports.Net最新版本】
此示例項目演示了如何使用組件屬性自定義Web查看器。您可以更改查看器元素的顏色,隱藏隱藏不必要的按鈕或菜單項,設置控件的默認狀態,更改Web查看器的某些行為。例如,設置Web查看器控件的默認寬度和heihgt,將默認工具欄顏色更改為LightGray,將默認報表縮放設置為150%并隱藏一些報表導出。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Customize_the_Viewer.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>Customize the Viewer</title> </head> <body> <form id="form1" runat="server"> <cc1:StiWebViewer ID="StiWebViewer1" runat="server" Width="1000px" Height="800px" Theme="Office2013LightGrayPurple" ScrollBarsMode="true" ZoomPercent="150" ToolbarDisplayMode="Separated" ShowExportToBmp="false" ShowExportToPcx="false" ShowExportToSvg="false" ShowExportToSvgz="false" ShowExportToPng="false" ShowExportToGif="false" ShowExportToSylk="false" ShowExportToMetafile="false" ShowExportToJpeg="false" ShowExportToTiff="false" ShowExportToDif="false" ShowExportToDbf="false" ShowExportToCsv="false" ShowExportToXml="false" ShowPrintButton="false" OnGetReport="StiWebViewer1_GetReport" /> </form> </body> </html>
要顯示報表,您應添加OnGetReport事件,您需要在該事件中加載報表模板文件,并在需要時注冊數據。
protected void Page_Load(object sender, EventArgs e) { } protected void StiWebViewer1_GetReport(object sender, Stimulsoft.Report.Web.StiReportDataEventArgs e) { string reportPath = Server.MapPath("Reports/SimpleList.mrt"); StiReport report = new StiReport(); report.Load(reportPath); string dataPath = Server.MapPath("Data/Demo.xml"); DataSet data = new DataSet(); data.ReadXml(dataPath); report.RegData(data); e.Report = report; }
示例代碼的結果如下圖所示:
購買Stimulsoft正版授權,請點擊“”喲!
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn