C++ .NET/windows form viewer help

  • Thread starter Thread starter Dean Poling
  • Start date Start date
D

Dean Poling

Hi, all...

I posted this in the Crystal Decisions user forums with no solution,
so here goes:

I have created a managed c++ dll that contains a crystal reports
viewer constructed with the windows form viewer and the native crystal
libraries included in vs.net. I want my users to be able to export a
displayed report to a file, and as luck would have it the default
crystal reports viewer has an export button that opens a 'save as'
type dialog. However, I want to limit my users to exporting to pdf
type files only.

I have tried various things like setting the ExportFormatType on the
report document, but the default 'save as' dialog still allows the
user to export to Word, Excel, etc. I suspect that I am close to
having this problem solved, but I'm missing something. Can anyone
help???

Thanks,
Dean
 
Hello Dean,

I reviewed your post carefully, and now I'd like to share the following
information with you:

1. I recommend you create a "Save File" dialog of you own (by using
System.Windows.Forms.FileDialog class) to limit the use to select pdf file
type, and then export the Crystal Report to a pdf file with the following
code snippet:

//------------------code snippet--------------------------
ExportOptions exportOpts = new ExportOptions();
DiskFileDestinationOptions diskOpts = new DiskFileDestinationOptions();

exportOpts = myRPT.ExportOptions;

diskOpts.DiskFileName = @"C:\...pdf";

exportOpts.ExportFormatType = ExportFormatType.PortableDocFormat;

exportOpts.ExportDestinationType = ExportDestinationType.DiskFile;

exportOpts.DestinationOptions = diskOpts;

myRPT.Export();
//----------------------end of-------------------------------

2. According to the Crystal Decision at
http://support.crystaldecisions.com/support/answers.asp?ref=default.asp_sele
ctlist, it states that you get two Crystal incidents with the purchase of
Visual Studio .NET. I suggest that you can contact Crystal Technical
Support to check whether there are any methods that you can use to limit
file types in its "Save As" dialog (say, by modifying registry values).

If the file type values are hard-coded in Crystal Report, you may need to
call FindWindow() to get the Window Handle to its "Save As" dialog, and
then modify the dialog manually. This should be the last resort.

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 
Back
Top