1498827 - How to set the list of available export types in the .NET CrystalReportViewer control

SAP Knowledge Base Article - Public

1498827 - How to set the list of available export types in the .NET CrystalReportViewer control

Symptom

  • A Visual Studio .NET 2010 application uses the CrystalReportViewer control to view Crystal Reports
  • Application users can export the report to different file formats by clicking the Export button on the viewer toolbar
  • How can the list of available export formats be customized?

Environment

  • Crystal Reports for Visual Studio 2010

Resolution

  • To specify the list of available export formats, set the AllowedExportFormats property of the CrystalReportViewer object using one or more of the ViewerExportFormat enumeration values.
  • If specifying more than one format, separate each format enumeration value with a pipe character.

The following sample code (C#) demonstrates how to set the CrystalReportViewer to export only to PDF and Excel file formats:

int exportFormatFlags = (int)(CrystalDecisions.Shared.ViewerExportFormats.PdfFormat | CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat);
CrystalReportViewer1.AllowedExportFormats = exportFormatFlags;

Keywords

select export format CR4VS2010 CR for Visual Studio 2010 VS2010 vsnet vs.net print view render custom limit value drop dropdown dialog dialogue save save-as window file bit toggle , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio