翻譯|使用教程|編輯:王香|2018-09-25 10:10:48.000|閱讀 532 次
概述:本文主要分別介紹了Stimulsoft報表中保存并加載Designer的事件。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
【下載Stimulsoft Reports.WPF最新版本】
此示例顯示如何在代碼中使用“Save”和“Load”事件。您可以 在應用程序初始化時將事件偵聽器添加到StiOptions.Engine.GlobalEvents:
public Window1() { StiOptions.Wpf.CurrentTheme = StiOptions.Wpf.Themes.Office2013Theme; InitializeComponent(); StiOptions.Engine.GlobalEvents.SavingReportInDesigner += new Stimulsoft.Report.Design.StiSavingObjectEventHandler(GlobalEvents_SavingReportInDesigner); StiOptions.Engine.GlobalEvents.LoadingReportInDesigner += new Stimulsoft.Report.Design.StiLoadingObjectEventHandler(GlobalEvents_LoadingReportInDesigner); }
然后指定加載報表時要執行的操作:
private void GlobalEvents_LoadingReportInDesigner(object sender, Stimulsoft.Report.Design.StiLoadingObjectEventArgs e) { e.Processed = true; StiReport report = new StiReport(); report.Load("..\\SimpleList.mrt"); designerControl1.Report = report; }
指定報表保存時要執行的操作:
private void GlobalEvents_SavingReportInDesigner(object sender, Stimulsoft.Report.Design.StiSavingObjectEventArgs e) { if (designerControl1.Report == null) return; e.Processed = true; designerControl1.Report.Save("Report.mrt"); }
示例代碼的結果如下圖所示:
購買Stimulsoft正版授權,請點擊“”喲!
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn