Writing Code
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Writing Code
Message Icon Topic: How to export report from invisible viewer? Post Reply Post New Topic
Author Message
blapath
Newbie
Newbie
Avatar

Joined: 04 Apr 2011
Location: Israel
Online Status: Offline
Posts: 4
Quote blapath Replybullet Topic: How to export report from invisible viewer?
    Posted: 30 Apr 2013 at 10:27pm
CR allows report export to various formats, like Word and PDF. Our customers don't want the CR viewing; they want just the Word/PDF export file, without opening the viewer. I tried to implement this logic as follows: CR viewer is part of our report from. I create the form, initialize CR viewer with the report (report definition, data source, connection, parameters etc). Instead of opening the form (ShowDialog), I call the viewer's export method.
This logic failed, with an error as 'Missing parameter values'.
If I open the form and execute the export, there is no error, export is generated.
So I tried opening the form outside the visible window; same error. I tried to open the form as minimized; same error again.
Last attempt was executing export from the Load event of the form. Interestingly, when opening the form the first time, I get the error. Any subsequent form opening works; the form is opened and show and the export is executed.

Obviously, parameter is not missing, as second time everything works. It seems the first activation and making the viewer visible does some initialization which are needed for export to succeed.

Does anyone has experience exporting (programmatically) from an invisible CR viewer?

/* BTW, the latest CR release includes a fix for a bug related to the message 'Missing parameter values'. Unfortunately that one is a different error, as the error occurs also with the latest release */
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 01 May 2013 at 6:04am
If you're just going to print and not actually display the report, you should be able to just create a "ReportDocument" object and print from there without showing it in a viewer.
 
-Dell
IP IP Logged
blapath
Newbie
Newbie
Avatar

Joined: 04 Apr 2011
Location: Israel
Online Status: Offline
Posts: 4
Quote blapath Replybullet Posted: 01 May 2013 at 8:20pm
I want to create an exported file (.DOC or .PDF), saving it into a file. The methos export to file failed, if the viewer is not visible
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 02 May 2013 at 4:22am
If you're working strictly with a ReportDocument object, NOT with a report that has been loaded into a viewer, the export to file methods should have no problems.  Please post the code you're using for the export.
 
-Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.063 seconds.