|
|
|
Re: How to export a birt report to xlsx? [message #931114 is a reply to message #930884] |
Tue, 02 October 2012 23:50 |
|
I do not think that option is currently in the viewer. Can you try adding the following code to the beforeFactory script of the report?
importPackage(Packages.org.eclipse.birt.report.engine.api);
reportContext.getRenderOption().setOption(EXCELRenderOption.OFFICE_VERSION, "office2007");
Jason
|
|
|
Re: How to export a birt report to xlsx? [message #1036272 is a reply to message #930534] |
Mon, 08 April 2013 06:56 |
Left Blank Messages: 1 Registered: April 2013 |
Junior Member |
|
|
The beforeFactory script did not work for me (Birt 4.2.2, nativexls emitter 1.0.0).
However, the viewer does have an option:
__excelRenderOption.officeVersion=office2007
this is not documented anywhere I could find, found out looking at the sources.
With the option the emitter generates xlsx formatted files, but still uses the xls extension for the file name. In order to change the extension name add the following entry to web.xml:
<context-param>
<param-name>BIRT_FILENAME_GENERATOR_CLASS</param-name>
<param-value>packagepath.XslRenamerFilenameGenerator</param-value>
</context-param>
And put this class in your sources:
import java.util.Map;
import org.eclipse.birt.report.utility.filename.DefaultFilenameGenerator;
import org.eclipse.birt.report.utility.filename.IFilenameGenerator;
public class XslRenamerFilenameGenerator extends DefaultFilenameGenerator implements IFilenameGenerator {
public String getFilename(String baseName, String extension, String outputType, Map options) {
return super.getFilename(baseName, "xls".equals(extension) ? "xlsx" : extension, outputType, options);
}
}
This is explained in more detail here:
birtworld.blogspot.com.au/2008/09/naming-exported-files-from-birt.html
|
|
|
Powered by
FUDForum. Page generated in 0.03794 seconds