原創(chuàng)|使用教程|編輯:鄭恭琳|2019-10-30 14:11:30.560|閱讀 255 次
概述:此示例說明如何加載報表模板并在Flash Designer中對其進(jìn)行編輯。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
立即點擊下載Stimulsoft Reports.Net最新版
此示例說明如何加載報表模板并在Flash Designer中對其進(jìn)行編輯。
首先,您需要將StiMvcDesignerFx組件添加到視圖頁面。您還需要將StiMvcDesignerFxOptions類型的對象傳遞給構(gòu)造函數(shù)。所需的最少選項是兩個操作——GetReport和DesignerEvent,它們位于操作“Actions”選項組中。最好定義預(yù)覽報表所需的PreviewReport操作。
@using Stimulsoft.Report.Mvc; ... @Html.Stimulsoft().StiMvcDesignerFx(new StiMvcDesignerFxOptions() { Actions = { GetReport = "GetReport", PreviewReport = "PreviewReport", DesignerEvent = "DesignerEvent" } })
在上面的選項中,我們定義了幾個動作,我們需要將其添加到控制器中。
GetReport操作將加載報告模板,并使用GetReportResult()靜態(tài)方法將響應(yīng)返回到Flash設(shè)計器的客戶端。在此方法的參數(shù)中,應(yīng)傳遞報表對象。
public ActionResult GetReport() { StiReport report = new StiReport(); report.Load(Server.MapPath("~/Content/Reports/TwoSimpleLists.mrt")); return StiMvcDesignerFx.GetReportResult(report); }
當(dāng)您在Flash設(shè)計器中打開預(yù)覽報表選項卡時,將調(diào)用PreviewReport操作。在此操作中,您可以獲取報表對象并執(zhí)行任何操作,例如連接到數(shù)據(jù)。要為客戶準(zhǔn)備答案,您應(yīng)該使用PreviewReportResult()靜態(tài)方法。在此方法的參數(shù)中,應(yīng)傳遞報表對象。
public ActionResult PreviewReport() { DataSet data = new DataSet("Demo"); data.ReadXml(Server.MapPath("~/Content/Data/Demo.xml")); StiReport report = StiMvcDesignerFx.GetReportObject(); report.RegData(data); return StiMvcDesignerFx.PreviewReportResult(report); }
DesignerEvent操作處理一些Flash設(shè)計器事件(使用數(shù)據(jù)字典、獲取報表模板代碼和組件圖像等),并使用DesignerEventResult()靜態(tài)方法將答案返回給客戶端。
public ActionResult DesignerEvent() { return StiMvcDesignerFx.DesignerEventResult(); }
在下面的屏幕截圖中,您可以看到示例代碼的結(jié)果。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn