In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
BIRT is an open source report system based on Eclipse developed for Web applications based on Java and JavaEE. Although it supports file export, it does not support dynamic customization of file names during export, especially in Chinese.
By default, Birt provides two ways to customize the name when exporting a file, as follows:
DefaultFilenameGenerator: the name of the report file. Suffix name TimestampFilenameGenerator: report file name + yyyyMMdd-HHmmss. Suffix name
If Birt implements the custom export file name, you need to implement the IFilenameGenerator API under the org.eclipse.birt.report.utility.filename package, as shown below:
Custom implementation of IFilenameGenerator interface public class CustomExportGenerator implements IFilenameGenerator {@ Override public String getFilename (String baseName, String fileExtension, String outputType, Map options) {return baseName + "." + fileExtension;}}
As you can see from the above code, the method in IFilenameGenerator does not provide a custom file name by default, which can only be obtained from the Map options parameter. Of course, if it is not too much trouble, you can override the getFilename interface.
Object obj = options.get ("httpRequest"); if (obj! = null & & obj instanceof RequestFacade) {RequestFacade request = (RequestFacade) obj; exportName = ParameterAccessor.getParameter (request, "_ _ filename");} configure Birt's export file generation class
Modify web.xml
BIRT_FILENAME_GENERATOR_CLASS org.eclipse.birt.report.utility.filename.CustomExportGenerator supports Chinese
File name: org.eclipse.birt.report.presentation.aggregation.layout.FramesetFragment
Method: doPreService (HttpServletRequest request, HttpServletResponse response)
Action:
String filename = ParameterAccessor.getExportFilename (new BirtContext (request, response), format, emitterId); String displayName = URLEncoder.encode (filename, "utf-8"); displayName = displayName .replace ("+", "% 20"); response.setCharacterEncoding ("utf-8"); response.setHeader ("contentType", "text/html; charset=utf-8") Response.setHeader ("Content-Disposition", / / $NON-NLS-1$ ParameterAccessor.htmlEncode (openType) + "; filename=\"+ ParameterAccessor.htmlEncode (displayName) +"\ "); modify the encoding of Tomcat
Access method:
Frameset?report=test.rptdesign&format=docx&__filename= test
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.