2118427 - How to limit the export formats in Crystal Reports for Visual Windows form viewer

SAP Knowledge Base Article - Public

2118427 - How to limit the export formats in Crystal Reports for Visual Windows form viewer

Symptom

I want to limit what export formats are available in a Windows Form Viewer application

Environment

Crystal Reports for Visual Studio .NET

Resolution

In your Preview Report button add the following code:


// set up the format export types:
int myFOpts = (int)(
    CrystalDecisions.Shared.ViewerExportFormats.RptFormat |
    CrystalDecisions.Shared.ViewerExportFormats.PdfFormat |
    CrystalDecisions.Shared.ViewerExportFormats.RptrFormat |
    CrystalDecisions.Shared.ViewerExportFormats.XLSXFormat |
    CrystalDecisions.Shared.ViewerExportFormats.CsvFormat |
    CrystalDecisions.Shared.ViewerExportFormats.EditableRtfFormat |
    CrystalDecisions.Shared.ViewerExportFormats.ExcelRecordFormat |
    CrystalDecisions.Shared.ViewerExportFormats.RtfFormat |
    CrystalDecisions.Shared.ViewerExportFormats.WordFormat |
    CrystalDecisions.Shared.ViewerExportFormats.XmlFormat |
    CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat |
    CrystalDecisions.Shared.ViewerExportFormats.ExcelRecordFormat);
//CrystalDecisions.Shared.ViewerExportFormats.NoFormat); // no exports allowed
//int myFOpts = (int)(CrystalDecisions.Shared.ViewerExportFormats.AllFormats);

crystalReportViewer1.AllowedExportFormats = myFOpts;
crystalReportViewer1.EnableToolTips = true;

Keywords

CR for VS, Export format options, .NET, Windows Form viewer , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

SAP Crystal Reports, developer version for Microsoft Visual Studio