文档彩票走势图>>Stimulsoft Reports.WinForms教程-2019>>【Stimulsoft Reports.WinForms教程】在Designer中保存和加载报表
【Stimulsoft Reports.WinForms教程】在Designer中保存和加载报表
【下载Stimulsoft Reports.Ultimate最新版本】
该示例显示如何在代码中使用“ Save”和“ Load”事件,您可以在应用程序初始化时将事件侦听器添加到StiDesigner类:
static Form1() { StiDesigner.SavingReport += new StiSavingObjectEventHandler(OnSaving); StiDesigner.LoadingReport += new StiLoadingObjectEventHandler(OnLoading); //If you need you can hide menu item "Save As.." StiMainMenuService service = StiMainMenuService.GetService(); service.ShowFileReportSaveAs = false; }
指定保存报表时要执行的操作:
private static void OnSaving(object sender, StiSavingObjectEventArgs e) { StiDesigner designer = sender as StiDesigner; //string str = designer.Report.SaveToString(); MessageBox.Show("Report saved"); }
指定加载报表时要执行的操作:
private static void OnLoading(object sender, StiLoadingObjectEventArgs e) { StiDesigner designer = sender as StiDesigner; //designer.Report.LoadFromString(str); MessageBox.Show("Report loaded"); }
示例代码的结果如下图所示: