zoukankan      html  css  js  c++  java
  • birt 批改导出的文件名【转】

    birt 修改导出的文件名

    birt 修改导出的文件名分两种实现方法,

    第一种:修改 web.xml 中 配置的 BIRT_FILENAME_GENERATOR_CLASS

    <!--
            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方法.

    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_CLASS

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

  • 相关阅读:
    P1311 选择客栈 模拟 ( + st表)
    P2656 采蘑菇 tarjan + spfa
    送别
    10.16互测题 贪心+数论
    poj 2823 Sliding Window 单调队列
    P1036 选数 dfs
    P3370 【模板】字符串哈希
    A Tear or A Smile?
    KMP 算法
    jQuery 中 attr 和 prop 的区别
  • 原文地址:https://www.cnblogs.com/load/p/3140392.html
Copyright © 2011-2022 走看看