日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Stimulsoft.Report 2、 web报表的使用

發布時間:2024/3/24 编程问答 45 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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頁面中放置報表顯示控件和報表設計控件

<cc1:StiWebViewer ID="StiWebViewer1" runat="server" GlobalizationFile="/reports/Localization/zh-CHS.xml" ShowDesignButton="True" onreportdesign="StiWebViewer1_ReportDesign" Theme="Office2010" BackColor="#e8e8e8"/><cc2:StiWebDesigner ID="StiWebDesigner1" runat="server" LocalizationDirectory="/reports/Localization/" Localization="zh-CHS"onsavereport="StiWebDesigner1_SaveReport" />

注:設置中文格式的文件夾應放置在項目的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报表的使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。