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

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

查看原文,下载示例

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值