How to prompt Export-Format-Dialog from CRView2008
I'm using Vs.net2008+CR2008 component to construct a win-from app.
As the legacy system uses CR9 component, when user click "export" in CRViewer9, it uses following code:
CRAXDRT.Report.Export true (VB6 code) to pop-up an export dialog that contains "Format" dropdownlist with "pdf,rtf,ODBC,MS word..." as options and "Destination" dropdownlist with "Application,disk file, MAPI..." as options.
Because CR2008 changes these behaviors a lot, I can't find some API to bring up that similar dialog to allow use to export by choosing "Format" and "Destination". It seems the only way is to develop that form using C# manually and deal with all these functionality.
Since our users insist to ask that behavior the same as legacy system. Can anybody help on this? Is there a good approach to deal with my case?
Thanks in advance.
Don Williams replied
You are correct, they have changed the export prompts in the new .NET viewer. There is an Export button that will all the user to select the format but it no longer allows you to specify the destination other than to Disk.
You can use it or as you indicated you will need to build your own export UI and program each destination. Here's a sample using RAS that can get you going:
private void Export_Click(object sender, EventArgs e)
//export Rtf to mapi
CrystalDecisions.CrystalReports.Engine.ReportDocument repdoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
CrystalDecisions.Shared.DiskFileDestinationOptions diskOpts = new CrystalDecisions.Shared.DiskFileDestinationOptions();
CrystalDecisions.Shared.ExportOptions ExpOpts = new CrystalDecisions.Shared.ExportOptions();
CrystalDecisions.Shared.HTMLFormatOptions htmlopts = new CrystalDecisions.Shared.HTMLFormatOptions();
CrystalDecisions.Shared.MicrosoftMailDestinationOptions MailOpts = new CrystalDecisions.Shared.MicrosoftMailDestinationOptions();
//repdoc = rptClientDoc;
ExpOpts = repdoc.ExportOptions;
ExpOpts.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.MicrosoftMail;
ExpOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.RichText;
diskOpts.DiskFileName = "MyReport.rpt";
MailOpts.MailToList = "Don Williams";
MailOpts.MailSubject = "Attached is a PDF file - .net Export test ";
MailOpts.MailSubject = "This is the Subject";
//MailOpts.MailCCList = "John Doe";
MailOpts.UserName = "intl
MailOpts.Password = "yourpassword";
ExpOpts.DestinationOptions = MailOpts;
Also note the RDC is no longer shipped in CR 2008.