SAP Knowledge Base Article - Public

3189234 - How to remove Crystal Report (RPT) from export drop-down menu with SDK?

Symptom

How to remove Crystal Report (RPT) from export drop-down menu with SDK?

Environment

Crystal For Eclipse SP28

Resolution

  • Use this method:
CrystalReportViewer cr = new CrystalReportViewer();
cr.removeExportFormat(com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat.crystalReports);
  • This method can be used either with JSP or when using BI4 jar files or with RAS OEM or Crystal report Server 2016 or 2020.
  • This method does not exist in Crystal for Eclipse.

Workaround in Crystal For Eclipse:

Hide the Export button from the default viewer using the method: setHasExportButton(false) and create a new an export menu with the rpt format following those samples: https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports+Java++SDK+Samples#CrystalReportsJavaSDKSamples-Exporting/Printing

  • With .Net SDK this is possible using this snippet of 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.CsvFormat |
CrystalDecisions.Shared.ViewerExportFormats.EditableRtfFormat |
CrystalDecisions.Shared.ViewerExportFormats.RtfFormat |
CrystalDecisions.Shared.ViewerExportFormats.WordFormat |
CrystalDecisions.Shared.ViewerExportFormats.XmlFormat |
CrystalDecisions.Shared.ViewerExportFormats.XLSXPagebasedFormat |
CrystalDecisions.Shared.ViewerExportFormats.XLSXRecordFormat |
CrystalDecisions.Shared.ViewerExportFormats.XLSXFormat |
CrystalDecisions.Shared.ViewerExportFormats.ExcelFormat |
CrystalDecisions.Shared.ViewerExportFormats.XLSXPagebasedFormat |
CrystalDecisions.Shared.ViewerExportFormats.XLSXRecordFormat |
CrystalDecisions.Shared.ViewerExportFormats.ExcelRecordFormat);
//CrystalDecisions.Shared.ViewerExportFormats.NoFormat); // no exports allowed
//int myFOpts = (int)(CrystalDecisions.Shared.ViewerExportFormats.AllFormats);

crystalReportViewer1.AllowedExportFormats = myFOpts;

See this blog on how to use CR 2020 Export to XLXS page formats:

https://blogs.sap.com/2022/03/31/how-to-use-the-new-cr-2020-export-to-microsoft-excelxlxs-in-visual-studio-.net-code/

See Also

https://wiki.scn.sap.com/wiki/display/BOBJ/Crystal+Reports+Java++SDK+Samples#CrystalReportsJavaSDKSamples-Exporting/Printing

https://blogs.sap.com/2022/03/31/how-to-use-the-new-cr-2020-export-to-microsoft-excelxlxs-in-visual-studio-.net-code/

Keywords

CR4E, Crystal server, Hide export format, invisible, crystal export SDK. , KBA , BI-DEV-JAV , BI Software Development Kits (SDKs) - Java , Problem

Product

SAP Crystal Server 2020

Attachments

sample code crystal viewer.zip
sample code crystal viewer.zip