1205111 - How to export a Crystal Report to an Application using the CR .NET SDK?

SAP Knowledge Base Article - Public

1205111 - How to export a Crystal Report to an Application using the CR .NET SDK?

Symptom

The Windows and web form viewers for the CR .NET SDK don't offer Application as a destination option. How can a Crystal Report be exported to an application with the CR .NET SDK?

Resolution

You can export a report to disk using the ExportToDisk method then use the System.Diagnostic.Process.Start method to open the file using the computer's default program for the file type.

CrystalDecisions.CrystalReports.Engine.ReportDocument boReportDocument = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
boReportDocument.Load(Application.StartupPath + "\\..\\..\\World Sales Report.rpt");

// You will need to clean up the exported files at a later time in your application. 

boReportDocument.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "C:\\Windows\\temp\\~boExport.pdf");

System.Diagnostics.Process.Start("C:\\Windows\\temp\\~boExport.pdf");

boReportDocument.Close();
boReportDocument.Dispose();

See Also

http://msdn.microsoft.com/en-us/library/92699yzt(VS.71).aspx

Keywords

Export to application, .NET app,Crystal Reports XI,Crystal Report XI R2 , 8177468, CRNET, NET , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio ; SAP Crystal Reports, version for Visual Studio .NET 2008