开发者

Crystal Reports 2010 All Reports Fail to Load Once the Report has been Exported to Any Format In WindowsXP

I have a WPF billing solution that is deployed using ClickOnce for more than 500 users, CrystaReports2010 were used for reporting, 85% of the users have WindowsXP installed on their machines :(

The Crystal Reports works just fine on the WindowsXP machines until the user exports a report with the built-in export button in the Crystal Reports Viewer, if he did this the export process complete successfully but he is not able t开发者_JS百科o open any other report in the solution until he restarts the application.

Crystal Reports 2010 All Reports Fail to Load Once the Report has been Exported to Any Format In WindowsXP

This is the error when trying to open a new report after the export:

Crystal Reports 2010 All Reports Fail to Load Once the Report has been Exported to Any Format In WindowsXP

I save the reports in my solution as content external resources outside the application .exe file, and I load them on demand, something like this:

var report = new ReportDocument();
report.Load(@"Reports\MyReport.rpt");

I made sure that after the user close a report to close and dispose of the report document object, so no memory leaks or exceeding the max number of open reports.

If I changed my implementation so that I save the reports inside my solution as embedded resources, the problem is solved, but this is not an option because the reports are relatively big in size (200KB-450KB), it will be a big DLL file that will be downloaded to the clients through ClickOnce whenever we release a new version that has any change to any report!. Another variation is to group each let's say four reports into one DLL, and still the same problem (1MB-2MB is still a big chunk). Knowing that we have a lot of reports and we get frequent change request for these reports according to changes in our client's policies. Please Help!


To solve this problem you have to change the installed .net version on the client machine from client profile to the full .net version.


Are you closing and disposing your report documents once you're finished with them?


At last, I found the solution :) The problem was that when you export a Crystal Report with the default export button provided by the Crystal Reports viewer, the export button changes the current working directory of the application to the export location!!! (strange behavior!!) and that is why the following line wont work anymore:

report.Load(@"Reports\MyReport.rpt");

So I changed this line to the following:

report.Load(AppDomain.CurrentDomain.BaseDirectory + "\\" + @"Reports\MyReport.rpt");

And it worked just like magic :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜