【Stimulsoft Reports.WPF教程】保存并加载Designer的事件

【下载StimulsoftReports.WPF最新版本】此示例显示如何在代码中使用“Save”和“Load”事件。您可以在应用程序初始化时将事件侦听器添加到StiOptions.Engine.GlobalEvents:publicWindow1(){StiOptions.Wpf.CurrentTheme=StiOptions.Wpf.Themes.Office20…

大家好,又见面了,我是你们的朋友全栈君。

【下载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

查看原文,下载示例

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/127347.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号