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

发布时间 : 2018-09-29 10:14:44.000|阅读 335 次

概述:本文主要介绍了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 xmlns="http://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

下载示例

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

FastReport2018.4


在线
客服
微信
QQ 电话
023-68661681
返回
顶部