birt 批改導出的文件名【轉】

birt 修改導出的文件名html

birt 修改導出的文件名分兩種實現方法,java

第一種:修改 web.xml 中 配置的 BIRT_FILENAME_GENERATOR_CLASSweb

 

<!--
        Filename generator class/factory to use for the exported reports.
    -->
    <context-param>
        <param-name>BIRT_FILENAME_GENERATOR_CLASS</param-name>
           <param-value>
                  org.eclipse.birt.report.utility.filename.TimestampFilenameGenerator 
           </param-value>
    </context-param>

 

 

    我是用的 TimestampFilenameGenerator ,那咱們就直接修改它的getFilename方法.eclipse

 

 

public String getFilename(String baseName, String fileExtension, String outputType, Map options)
  {
    DateFormat dateFormatter = new SimpleDateFormat(this.datePattern);
    if (fileExtension == null)
    {
      fileExtension = "";
    }
    ResourceBundle resource = ResourceBundle.getBundle("report_name_cn", Locale.CHINA);
    try
    {
      baseName = new String(resource.getString(baseName).getBytes("iso-8859-1"), "utf-8");
    } catch (Exception e) {
      baseName = "未命名";
    }

    return baseName + "_" + dateFormatter.format(new Date()) + "." + fileExtension;
  }

 

第二種: 就是本身實現IFilenameGenerator 接口,並配置 BIRT_FILENAME_GENERATOR_CLASSthis

 

http://www.myexception.cn/open-source/727373.htmlspa

相關文章
相關標籤/搜索