1765153 - How to customize .NET Viewer Control Export button to manage custom export options and enable Application as the destination.

SAP Knowledge Base Article - Public

1765153 - How to customize .NET Viewer Control Export button to manage custom export options and enable Application as the destination.

Symptom

  • Exporting from the Windows Viewer does not prompt for the various Export options as it does in Crystal Reports Designer.
  • Exporting from the Windows Viewer does not allow users to select the output file type destination as Application, only allows to save to disk.
  • Is there a sample application that demonstrates how to manage this in the Windows .NET Viewer.

Environment

Crystal Reports for Visual Studio 2010

Cause

There is no Export Button Click Event to capture.

Resolution

 

  1. When Designing reports select the menu File -> Export -> Report Export options
  2. Chose the first format you wish to use and set all properties as required or desired.
  3. Do this for each format option.
  4. Save the report, these default export properties are now saved in the rpt file and will be used the next time the report is exported using the Default Export button of the Viewer.
  5. See the attached sample application that replaces the Crystal Report Viewer Export button with a new button labeled "Export"
  6. Within the application you can now use the default export types as defined in the First Option above or add additional code to handle the specific export options as required by your application.

PLEASE NOTE: Crystal Reports buttons may not be indexed in the same order or have the same ID in each version so this may change when updating your Crystal Reports Runtime.

Where to find the code:

Look in ExportFormat.cs for the defined file types, comment out any you do not want to support or use.

Exportcontrols.cs has the actual export functions.

Also note: Not added to the sample is the use of CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument.get_SavedExportOptions(CrystalDecisions.ReportAppServer.ReportDefModel.CrReportExportFormatEnum)

This API allows the Developer to get the saved report option from the report file.

Keywords

Export Button Click Event, Custom Export Options, Crystal Reports for Visual Studio 2010 , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio

Attachments

CRExportSample.zip