// toword public String toword(HttpServletResponse response, String id) throws Exception { User user = ActionContext.getCurrentUserInThread(); try { BuSpywCspsxkzsqVO vo = this.findById(id); String filePath = Constants.getString(Constants.PATH_TEMPLATE_WORD, ""); // 转前 ftl 路径 String pdfPath = Constants.getString(Constants.PATH_TEMPLATE_XML, ""); // 转后 pdf 路径 String ftlName = Constants.getString("template_word_js_17", ""); String workName = Constants.getString("template_word_js_17", "") + "" + vo.getCspsxkzsq_uid() + ""; // 复选框的判断 String Wszx_gyws = vo.getSfclml(); if (org.apache.commons.lang3.StringUtils.isBlank(Wszx_gyws)) { vo.put("SFCLML", ""); } FreemarkerHelper.createWord(vo, filePath, ftlName, pdfPath, workName); String filename = Constants.getString(Constants.PATH_TEMPLATE_XML, "") + "" + workName; Word2PDF word2pdf = new Word2PDF(); word2pdf.toPdf(filename); return filename + ".xml.pdf"; } catch (DaoException e) { return null; } }
// toword public boolean toword(String id) throws Exception { User user = ActionContext.getCurrentUserInThread(); String domresult = ""; try { BuSpywCspsxkzsqVO vo = this.findById(id); String filePath = Constants.getString(Constants.PATH_TEMPLATE_WORD, ""); // 转前 ftl 路径 String pdfPath = Constants.getString(Constants.PATH_TEMPLATE_XML, ""); // 转后 pdf 路径 String ftlName = Constants.getString("template_word_js_17", ""); String workName = "十七_" + Constants.getString("template_word_js_17", "") + "_" + vo.getCspsxkzsq_uid() + ".doc"; // 复选框的判断 String Wszx_gyws = vo.getSfclml(); if (org.apache.commons.lang.StringUtils.isBlank(Wszx_gyws)) { vo.put("SFCLML", ""); } FreemarkerHelper.createWord(vo, filePath, ftlName, pdfPath, workName); String filename = Constants.getString(Constants.PATH_TEMPLATE_XML, "") + "\\" + workName; Word2PDF word2pdf = new Word2PDF(); word2pdf.toPdf(filename); } catch (DaoException e) { return false; } finally { } return true; }