freemarker对数字格式的处理

📅 发布时间:2026/7/6 16:20:30 👁️ 浏览次数:
freemarker对数字格式的处理
场景导出word xml时数字都带有逗号(实际情况要去掉)如图修改需要如下红色代码设置下private void generateWordDocument(MapString, Object rootMap, OutputStream out) throws Exception {String filePath XhxhzjmQzController.class.getClassLoader().getResource(/).getPath() File.separator template File.separator xhxhzjmqz;Configuration cfg new Configuration(Configuration.VERSION_2_3_22);cfg.setDefaultEncoding(UTF-8);cfg.setDirectoryForTemplateLoading(new File(filePath));cfg.setNumberFormat(#);Template temp cfg.getTemplate(xhbgyl.ftl, utf-8);try (Writer writer new OutputStreamWriter(out, UTF-8)) {temp.process(rootMap, writer);}}