保存并重新加载保存的 rdlc 报告
我正在 WPF 中开发一个应用程序,需要在其中生成并显示报告。我正在使用 RDLC 来生成和显示报告。报告的要求是
- 应该生成并显示报告。
- 用户应该能够保存报告(他们没有指定保存报告的格式。)
- 用户应该能够加载和查看保存的报告。
我目前正在做的是,我正在从 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
- Should generate and show report.
- The user should be able to save the report (they havent specified the format to save the report.)
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我看来,你可以通过分离关注点来提高你的表现。我的意思是,最好从自定义类生成报告的数据集,而不是直接从数据库生成。
例如,如果我希望我的报告显示:订单年份-订单总数-客户。我将创建一个类似的类
一旦你完成了这个,你将能够利用多线程。例如,我知道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
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.