EducationSoftwareStrategy.com
StrategyCommunity

Knowledge Base

Product

Community

Knowledge Base

TopicsBrowse ArticlesDeveloper Zone

Product

Download SoftwareProduct DocumentationSecurity Hub

Education

Tutorial VideosSolution GalleryEducation courses

Community

GuidelinesGrandmastersEvents
x_social-icon_white.svglinkedin_social-icon_white.svg
Strategy logoCommunity

© Strategy Inc. All Rights Reserved.

LegalTerms of UsePrivacy Policy
  1. Home
  2. Topics

KB14065: How to change the name of report export to Microsoft Excel with formatting in MicroStrategy Java Web SDK


Community Admin

• Strategy


In older versions of MicroStrategy Web SDK, it was possible to assign custom report name when report is exported to Microsoft Excel with formatting. This customization was accomplished by extending ReportExportHTMLTransform.

In older versions of Strategy Web SDK, it was possible to assign custom report name when report is exported to Microsoft Excel with formatting. This customization was accomplished by extending ReportExportHTMLTransform.
 
In Strategy Web 9.2.1 and 9.4.x, the binary Microsoft Excel file is generated by the Strategy Intelligence Server. 
 
In order to accomplish the same customization in Strategy Web/SDK 9.2.1 and 9.4.x, a new method setCustomReportName(java.lang.String customName) has to be called on ExportBean in a custom addon added to export pages in pageConfig.xml. To do this, follow the steps below:
 
The following sample code illustrates how to access ExportBean and change the report name to 'Custom Report Name' in Strategy SDK 9.2.1 or 9.4.x for exports to Microsoft Excel with formatting:
 
package com.Strategy.sdk.addons;
 
import com.Strategy.web.app.addons.AbstractAppAddOn;
import com.Strategy.web.app.beans.EnumExportFormats;
import com.Strategy.web.app.beans.ExportBean;
import com.Strategy.web.app.beans.PageComponent;
import com.Strategy.web.beans.WebComponent;
 
public class ModifyReportNameExportAddon extends AbstractAppAddOn {
 
public void preCollectData(PageComponent page) {
 
ExportBean eb = getExportBean(page);
if (eb != null) {
String name = "Custom Report Name";
String formatType = eb.getExportFormat().getExportFormatType();
if (Integer.parseInt(formatType) == EnumExportFormats.ExportFormatExcelWithFormattingIServer) {
eb.setCustomReportName(name);
}
}
}
 
protected ExportBean getExportBean(WebComponent wc) {
 
ExportBean result = null;
if (wc instanceof ExportBean) {
result = (ExportBean) wc;
} else {
for (int i = 0; i < wc.getChildCount(); i++) {
result = getExportBean(wc.getChild(i));
if (result != null) {
break;
}
}
}
return result;
}
 
public String getAddOnDescription() {
 
return "Modifies the name of the report when exporting to Excel with formatting";
}
}
 
NOTE: If the condition 'if (Integer.parseInt(formatType) == EnumExportFormats.ExportFormatExcelWithFormattingIServer)' is removed from the above code sample, then the custom report name is applied to all export types except export to PDF. Export to Microsoft Excel with plain text, CSV, Microsoft Excel with formatting, HTML, and Plain text will be affected by this customization.
For instructions on how to implement this addon using the Web Customization Editor, see the following link:
https://www2.microstrategy.com/producthelp/Current/WebSDK/Content/topics/webcusteditor/custtasks/WCE_Creating_a_New_Add-on_for_a_Page.htm
  
CUSTOMIZATION WARNING:
This customization is provided as a convenience to Strategy users and is only directly applicable to the version stated. While this code may apply to other releases directly, Strategy Technical Support makes no guarantees that the code provided will apply to any future or previous builds. In the event of a code change in future builds, Strategy Technical Support makes no guarantee that an updated version of this particular customization will be provided. In the event of a code change in future builds, Strategy may not be able to provide additional code on this matter even though this customization is provided at this time for this specific build. For enhancements to this customization or to incorporate similar functionality into other versions, contact your Account Executive to inquire about Strategy Consulting assistance.
 


Comment

0 comments

Details

Knowledge Article

Published:

June 23, 2017

Last Updated:

June 23, 2017