【Stimulsoft Reports.Net教程】自定义查看器

本文主要介绍了Stimulsoft报表中如何使用组件属性自定义Web查看器,可以更改查看器元素的颜色,隐藏隐藏不必要的按钮或菜单项,设置控件的默认状态,更改Web查看器的某些行为。

【下载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 ><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

下载示例

购买Stimulsoft正版授权,请点击“咨询在线客服”哟!

FastReport2018.4

标签:报表解决方案报表.NET报表控件报表设计stimulsoft report .netStimulsoft

来源:慧都

声明:本站部分文章及图片转载于互联网,内容版权归原作者所有,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!

上一篇 2018年8月25日
下一篇 2018年8月26日

相关推荐

发表回复

登录后才能评论