asp.net (webform)使用FastReport實現預覽


1.新建項目

2.添加引用

 

 3.config中添加如下

<system.web>
<httpHandlers>
<add path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport" />
</httpHandlers>
</system.web>

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<handlers>
<add name="FastReportHandler" path="FastReport.Export.axd" verb="*" type="FastReport.Web.Handlers.WebExport" />
</handlers>
</system.webServer>

4.界面(有些初次使用的同志可能需要在工具箱添加FastReport控件)

 

 

 5.后台代碼

dt = new DataTable();
tjrq = tjrq.Substring(0, 10);
////// 查的存檔信息
dt = db.MysqlDataTable("SQL語句");
FastReport.Web.WebReport webReport = new FastReport.Web.WebReport();
string Path = Server.MapPath("~/report/rp_duib1__bak.frx");//模板路徑
dt.TableName = "health_data";//表名
DataSet dsa = new DataSet();
dsa.Tables.Add(dt.Copy());
WebReport2.ReportFile = Path;
WebReport2.RegisterData(dsa);

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM