Stimulsoft.Report 2、 web报表的使用
Stimulsoft.Report web報(bào)表的使用,有需要的朋友可以參考下。
1、先用報(bào)表設(shè)計(jì)工具設(shè)計(jì)報(bào)表Report1.mrt(具體參照Stimulsoft_Reports 1. 報(bào)表制作http://blog.csdn.net/qq_31971935/article/details/50681730)
2、在項(xiàng)目中添加對(duì)Stimulsoft.Base.dll、Stimulsoft.Report.dll、Stimulsoft.Report.Web.dll、Stimulsoft.Report.WebDesign.dll的引用
3、在aspx頁(yè)面中注冊(cè)控件
<%@ register Namespace="Stimulsoft.Report.Web" TagPrefix="cc1" Assembly="Stimulsoft.Report.Web"%> <%@ register Namespace="Stimulsoft.Report.Web" TagPrefix="cc2" Assembly="Stimulsoft.Report.WebDesign"%>注:注冊(cè)控件方式:
<%@ Register TagPrefix=”abc” Namespace=”空間名.類名” Assembly=”空間名.類名” %>
4、aspx頁(yè)面中放置報(bào)表顯示控件和報(bào)表設(shè)計(jì)控件
注:設(shè)置中文格式的文件夾應(yīng)放置在項(xiàng)目的bin下面即可。
5、在代碼文件中引用
using Stimulsoft.Report;
6、在Page_Load中
string filepath = Server.MapPath("~/Report1.mrt"); StiReport stireport = new StiReport(); stireport.Load(filepath); stireport.Compile(); StiWebViewer1.Report = stireport;7、在StiWebViewer1的ReportDesign中
string filepath = Server.MapPath("~/Report1.mrt"); StiReport stireport = new StiReport(); stireport.Load(filepath); stireport.Compile(); StiWebDesigner1.Design(stireport);8、在StiWebDesigner1的SaveReport中
var report = e.Report; string filepath = Server.MapPath("~/Report1.mrt"); report.Save(filepath);aspx頁(yè)面:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Stimulsoft_Reports.WebForm1" %> <!DOCTYPE html> <%@ register Namespace="Stimulsoft.Report.Web" TagPrefix="cc1" Assembly="Stimulsoft.Report.Web"%> <%@ register Namespace="Stimulsoft.Report.Web" TagPrefix="cc2" Assembly="Stimulsoft.Report.WebDesign"%><html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/><title></title> </head> <body><form id="form1" runat="server"><div><cc1:StiWebViewer ID="StiWebViewer1" runat="server" GlobalizationFile="/Content/page/reports/Localization/zh-CHS.xml" ShowDesignButton="True" onreportdesign="StiWebViewer1_ReportDesign" Theme="Office2010" BackColor="#e8e8e8"/><cc2:StiWebDesigner ID="StiWebDesigner1" runat="server" LocalizationDirectory="/Content/page/reports/Localization/" Localization="zh-CHS" onsavereport="StiWebDesigner1_SaveReport" /></div></form> </body> </html>aspx.cs后臺(tái)代碼:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Stimulsoft.Report; namespace Stimulsoft_Reports {public partial class WebForm1 : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e){string filepath = Server.MapPath("~/Report1.mrt");StiReport stireport = new StiReport();stireport.Load(filepath);stireport.Compile();StiWebViewer1.Report = stireport;}protected void StiWebViewer1_ReportDesign(object sender, Stimulsoft.Report.Web.StiReportDesignEventArgs e){string filepath = Server.MapPath("~/Report1.mrt");StiReport stireport = new StiReport();stireport.Load(filepath);stireport.Compile();StiWebDesigner1.Design(stireport);}protected void StiWebDesigner1_SaveReport(object sender, Stimulsoft.Report.Web.StiWebDesigner.StiSaveReportEventArgs e){var report = e.Report;string filepath = Server.MapPath("~/Report1.mrt");report.Save(filepath);}} }項(xiàng)目文件結(jié)構(gòu)圖:
運(yùn)行后效果:
總結(jié)
以上是生活随笔為你收集整理的Stimulsoft.Report 2、 web报表的使用的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 软件工程导论读书笔记
- 下一篇: three.js 3D室内设计 -