joget项目中的word导出插件
插件本身由公司大牛开发,但是大牛离职,客户有新需求,所以由我来修改
插件本身调用了joget自带的将joget表单转换为html的方法
String header = getPropertyString("headerHtml");
header = AppUtil.processHashVariable(header, null, null, null);
...
String s = FormPdfUtil.formatHtml(selectedFormHtml, header, footer, css, showNotSelectedOptions, repeatHeader, repeatFooter);
其中FormPdfUtil.formatHtml的参数 是由AppUtil获取到的 流程哈希变量的值 ,然后交由 FormPdfUtil转换成html格式
而后大牛使用了 类库 Doc4j 将html转换成word形式
// To docx, with content controls
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
XHTMLImporterImpl XHTMLImporter = new XHTMLImporterImpl(wordMLPackage);
wordMLPackage.getMainDocumentPart().getContent().addAll(
XHTMLImporter.convert( xhtml, null) );
wordMLPackage.save(new java.io.File(outfile));
但是由