MicroStrategy ONE

Modifying Export Properties for a Report Programmatically

There may be instances when you want to customize the preferences for exporting a report to PDF or Excel. Since exporting preferences are stored as extended properties on the report instance, you accomplish your customization by modifying specific extended properties. The following scenarios illustrate how to use the most common properties. 

The code samples used for these scenarios provide examples of how to read existing values for headers and footers as well as how to append new values to existing ones, using the appendValueToProperty() and replacePropertyValue() methods.

Modifying Settings for Exporting a Report to Excel (with Formatting Only)

In this customization scenario, you modify the preferences that are used when exporting a report to Excel (with formatting) so that a separate report is displayed for each item in the page-by axis and each report is displayed on a separate Excel spreadsheet. You accomplish this by first creating a custom add-on that allows you to set the two common properties listed below and then setting the values for these properties on the page used for exporting to Excel.

Property

Value

expandPageByFields

Assuming there is an element in the page-by axis, setting this property to “true" will print one grid for every item in the page-by axis.

useSeparateSheets

If expandPageByFields is set to “true€? and this property is also set to “true", each grid will be shown on a separate spreadsheet in Excel.

Because these preferences are applied only when you are using Excel 2003 and above, you must set the Export preference to these versions.

This customization can be accomplished using either of the following methods:

Deploying the plug-in provided with MicroStrategy SDK

MicroStrategy SDK provides a plug-in (ZIP file) that can simply be extracted to thepluginsfolder to view the customization in MicroStrategy Web. The following steps guide you in locating the plug-in and deploying it. 

  1. Access the plug-in: JSP version or ASP .NET version

  2. Extract the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder.   

  3. Launch MicroStrategy Web to view the customization.

When you export a report to Excel with formatting, a separate report will be displayed for each item in the page-by axis and each report will be printed on a separate page.

Using the Web Customization Editor to create a plug-in

MicroStrategy SDK provides a Web Customization Editor that can be used to create a customization plug-in. The following steps guide you in creating the plug-in and deploying it. 

  1. Launch the Web Customization Editor

  2. Click on MicroStrategy Web Configuration inside the Application Settings view to expand the hierarchical tree. The expanded list comprises the different settings that can be modified to perform customizations. 

  3. Click on Pages to expand the list of pages used in MicroStrategy Web. 

  4. Right-click exportBinary (ExportBinary) and select Create New Add-on. This launches the Add-on Creation wizard

  5. Click Browse to select the source folder for the project. 

  6. Enter com.microstrategy.sdk.samples.addons in the Package text field. 

  7. Enter ModifyReportExportSettingsAddOn in the Name text field. 

  8. Enter Modifies report properties for exporting in the Description text field. 

  9. Click Next

  10. Click Finish. ModifyReportExportSettingsAddOn.java opens in the editor. The sample, ModifyReportExportSettingsAddOn.java, contains the entire code for this custom transform. 

  11. Save your changes. 

  12. Double-click exportBinary (ExportBinary) and click the Add-on Properties tab at the bottom in the right frame. 

  13. With com.microstrategy.sdk.samples.addon.ModifyReportExportSettingsAddOn selected in the Add-ons section, click Add New in the Add-on properties section. 

  14. Select expandPageByFields and useSeparateSheets, and click >>

  15. Click OK

  16. In the Add-on properties section, enter true as the value for add-on property expandPageByFields

  17. In the Add-on properties section, enter true as the value for add-on property useSeparateSheets

  18. Save your changes. 

  19. Launch MicroStrategy Web to view the customization. When you export a report to Excel with formatting, a separate report will be displayed for each item in the page-by axis and each report will be printed on a separate page.

Modifying Settings for Exporting a Report to PDF

In this customization scenario, you modify the preferences that are used when exporting a report to PDF so that new values are provided for headers and footers, these new values are appended to existing values, a cover page is not printed, and reports in Grid/Graph mode are not printed on the same page. You accomplish this by first creating a custom add-on that allows you to set the common report properties listed below and then setting the values for these properties on the page used for exporting to PDF.

Property Value

overwriteSettings

Tells the addon whether headers and footers should be overwritten or appended to an existing value. This applies to headers and footers.

leftHeader

Text or macro to be used on the left header.

centerHeader

Text or macro to be used on the center header.

rightHeader

Text or macro to be used on the right header.

leftFooter

Text or macro to be used on the left footer.

centerFooter

Text or macro to be used on the center footer.

rightFooter

Text or macro to be used on the right footer.

printCover

Specifies whether a "cover page with filter details" should be printed.

showGridAndGraph

Specifies whether grid & graph should be printed on the same page (available only when the report page is in Grid & Graph mode).

This customization can be accomplished using either of the following methods:

Deploying the plug-in provided with MicroStrategy SDK

MicroStrategy SDK provides a plug-in (ZIP file) that can simply be extracted to thepluginsfolder to view the customization in MicroStrategy Web. The following steps guide you in locating the plug-in and deploying it. 

  1. Access the plug-in: JSP version or ASP .NET version

  2. Extract the plug-in to the plugins subfolder inside the MicroStrategy Web installation folder.   

  3. Launch MicroStrategy Web to view the customization.

When you export a report to PDF, there is no cover page, new values are appended to existing values for headers and footers, and reports in Grid/Graph mode are printed on separate pages.

Using the Web Customization Editor to create a plug-in

MicroStrategy SDK provides a Web Customization Editor that can be used to create a customization plug-in. The following steps guide you in creating the plug-in and deploying it. 

  1. Launch the Web Customization Editor

  2. Click on MicroStrategy Web Configuration inside the Application Settings view to expand the hierarchical tree. The expanded list comprises the different settings that can be modified to perform customizations. 

  3. Click on Pages to expand the list of pages used in MicroStrategy Web. 

  4. Right-click pdfDisplay (PDF Display) and select Create New Add-on. This launches the Add-on Creation wizard

  5. Click Browse to select the source folder for the project. 

  6. Enter com.microstrategy.sdk.samples.addons in the Package text field. 

  7. Enter ModifyReportPDFSettingsAddOn in the Name text field. 

  8. Enter Modifies report properties for exporting to PDF in the Description text field. 

  9. Click Next

  10. Click Finish. ModifyReportPDFSettingsAddOn.java opens in the editor. The sample, ModifyReportPDFSettingsAddOn.java, contains the entire code for this custom transform. 

  11. Save your changes. 

  12. Double-click pdfDisplay (PDF Display) and click the Add-on Properties tab at the bottom in the right frame. 

  13. With com.microstrategy.sdk.samples.addon.ModifyReportPDFSettingsAddOn selected in the Add-ons section, click Add New in the Add-on properties section. 

  14. Select all properties, and click >>

  15. Click OK

  16. In the Add-on properties section, enter these values for the add-on properties.

Property Value

overwriteSettings

false

leftHeader

Left Header

centerHeader

Center Header

rightHeader

Right Header

leftFooter

Left Footer

centerFooter

Center Footer

rightFooter

Right Footer

printCover

false

showGridAndGraph

false

  1. Save your changes. 

  2. Launch MicroStrategy Web to view the customization.  When you export a report to PDF, there is no cover page, new values are appended to existing values for headers and footers, and reports in Grid/Graph mode are printed on separate pages.

See Also