保存并重新加载保存的 rdlc 报告

发布于 2024-09-10 04:09:18 字数 505 浏览 0 评论 0原文

我正在 WPF 中开发一个应用程序,需要在其中生成并显示报告。我正在使用 RDLC 来生成和显示报告。报告的要求是

  1. 应该生成并显示报告。
  2. 用户应该能够保存报告(他们没有指定保存报告的格式。)
  3. 用户应该能够加载和查看保存的报告。

我目前正在做的是,我正在从 RDLC 文件生成一个临时 pdf 文件来显示报告。如果用户希望保存报告,报告将保存为 PDF,否则临时 PDF 文件将被删除。当用户想要加载保存的报告时,他可以,因为它是 PDF 格式。

在程序中,我使用WPF中的“winformhost”控件来显示报告。还使用 ReportViewer 控件。

但我现在面临的问题是,由于我们也使用“winformhost”控件和PDF格式,因此显示报告相当慢。

我的问题是,如果我使用这种生成 PDF 报告并将其显示的逻辑,如何提高性能?如果不可能,是否有其他方法可以保存报告并在需要时重新加载它,从而增加报告显示的过程?

提前致谢, 安尼什

I am developing an application in WPF in which I need to generate and show reports. I am using RDLC for generating and showing reports. The requirement for reports are

  1. Should generate and show report.
  2. The user should be able to save the report (they havent specified the format to save the report.)
  3. The user should be able to load and view the saved report.

What I am currently doing is that, I am generating a temporary pdf file out of RDLC file to show the report. If the user wish to save the report, the report will be saved as PDF otherwise the temporary PDF file will be deleted. And when user wants to load the saved report, he can, as it is PDF format.

In the program, I am using "winformhost" control in WPF to show the report. A ReportViewer control is also used.

But the problem that I am now facing is that it is rather slow to show a report since we are using the "winformhost" control and PDF format as well.

My question is that How can I increase the performance if I am using this logic of generating and showing the report as PDF? If it is not possible, is there any other way in which I can save the report and re-load it whenever I want, which increases the process of report showing?

Thanks in advance,
Anish

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

瀟灑尐姊 2024-09-17 04:09:18

在我看来,你可以通过分离关注点来提高你的表现。我的意思是,最好从自定义类生成报告的数据集,而不是直接从数据库生成。

例如,如果我希望我的报告显示:订单年份-订单总数-客户。我将创建一个类似的类

class CustomerStatistics
{
    public int OrderYear {get;set;}
    public int OrderQty {get;set;}
    public string CustomerName {get;set;}

} 

一旦你完成了这个,你将能够利用多线程。例如,我知道OrderQty的计算需要一段时间,所以我把它放在一个单独的线程中。

此外,您可以通过为一些需要处理大型数据集的繁重计算创建存储过程来提高性能。如果是这种情况,您应该使用集合操作,如 INTERSECT、EXCEPT 等。来优化查询。

这是我的一些想法。

干杯。

In my opinion, you can increase your performance by separating concerns. By this I mean, it's better to generate the data set for the report from your custom class rather than directly from DB.

For instance if I want my report to show : the order year- the total number of orders - customer. I will create a class like

class CustomerStatistics
{
    public int OrderYear {get;set;}
    public int OrderQty {get;set;}
    public string CustomerName {get;set;}

} 

Once you have done that, you will be able to take advantages of multi-threading. For instance, I know that the calculation of OrderQty will take a while, so I put it in a separate thread.

Besides, you can boost your performance by creating stored-procedures for some heavy calculations in which you need to go through a large data set. If it is the case, you should use set operations like INTERSECT, EXCEPT,etc. to optimize the queries.

That was some of my thoughts.

Cheers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文