Stimulsoft.Report 2、 web报表的使用
生活随笔
收集整理的這篇文章主要介紹了
Stimulsoft.Report 2、 web报表的使用
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Stimulsoft.Report web報表的使用,有需要的朋友可以參考下。
1、先用報表設計工具設計報表Report1.mrt(具體參照Stimulsoft_Reports 1. 報表制作http://blog.csdn.net/qq_31971935/article/details/50681730)
2、在項目中添加對Stimulsoft.Base.dll、Stimulsoft.Report.dll、Stimulsoft.Report.Web.dll、Stimulsoft.Report.WebDesign.dll的引用
3、在aspx頁面中注冊控件
<%@ register Namespace="Stimulsoft.Report.Web" TagPrefix="cc1" Assembly="Stimulsoft.Report.Web"%> <%@ register Namespace="Stimulsoft.Report.Web" TagPrefix="cc2" Assembly="Stimulsoft.Report.WebDesign"%>注:注冊控件方式:
<%@ Register TagPrefix=”abc” Namespace=”空間名.類名” Assembly=”空間名.類名” %>
4、aspx頁面中放置報表顯示控件和報表設計控件
注:設置中文格式的文件夾應放置在項目的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頁面:
<%@ 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后臺代碼:
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);}} }項目文件結構圖:
運行后效果:
總結
以上是生活随笔為你收集整理的Stimulsoft.Report 2、 web报表的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 软件工程导论读书笔记
- 下一篇: three.js 3D室内设计 -