SAP BusinessObjects Enterprise BI 4.0 – Modify the Crystal Reports Viewer Export Format List
In this current series of SAP BusinessObjects Enterprise BI 4.0 – What’s New with the SDKs?, I’m describing new SDK functionality that I find particularly interesting in the recently released SAP BusinessObjects Enterprise BI 4.0 product. In this brief blog entry, I’ll describe how you can modify the export format list as presented by the Crystal Report Viewer.
Crystal Report Viewer Export List
Create a bit of code to bring up a Crystal Report in the Crystal Report Web Viewer, then click on the export button. In the export dialog box that appears, select the export format drop-down, and what you see is the following:
That’s one of the features of the viewer – it supports a lot of export formats.
But there’s times where you can’t or don’t want to give your clients so many choices. For example, security and document assurance policies at an organization may explicitly prevent people from accessing the Crystal Reports (RPT) format, to eliminate any possibility of document modification.
Or for more casual users, you may want to restrict them to only PDF and Excel exports.
In previous versions of the viewer, there wasn’t a fully supported way of trimming specific export formats from the drop-down. You could eliminate the export functionality altogether – which is typically not what clients want – but within strict supported deployments, you had to accept all the export formats, or none.
Then with XI 3.0, it no longer was possible to modify the export format list via the export.js – changes in the internal code essentially made the list not accessible via static files. The workaround then implemented by a few involved HTTP filters – to capture and modify the outgoing HTML stream at the web app server to eliminate the unwanted exports. This was, as you can imagine, much harder to maintain.
Removing an Export Format via the Viewer SDK
The new SAP BusinessObjects Enterprise BI 4.0 version of the Viewer SDK introduces a new method, the CrystalReportViewer.removeExportFormat(…) method.
Given an instance of the CrystalReportViewer, invoking the following:
results in the following drop-down:
And there you have it – only the PDF export format remains. It’s that simple!
I’m very happy that this enhancement made it into the product – the ability to modify the export list was one of the things frequently asked for by both external and internal coders.
Sample code for the above example is downloadable: JAVA_ENTERPRISE_BE14_CR_WEB_VIEW_REMOVE_EXPORT_FORMATS