版权声明:本文为HaiyuKing原创文章,转载请注明出处!
尝试的方案包括以下几种:
参考资料:《FreemarkerJavaDemo【Android将表单数据生成Word文档的方案之一(基于freemarker2.3.28,只能java生成)】》
参考资料:《PoiDemo【Android将表单数据生成Word文档的方案之二(基于Poi4.0.0)】》【目前使用这个】
《PoiDocxDemo【Android将表单数据生成Word文档的方案之二(基于Poi4.0.0),目前只能java生成】》
参考资料:《官网》
demo中的替换文本用法很简单:
import com.independentsoft.office.word.WordDocument; public class Example { public static void main(String[] args) { try { WordDocument doc = new WordDocument("c:\\test\\input.docx"); doc.replace("[CustomerID]", "12345"); doc.replace("[CustomerName]","John Smith"); doc.save("c:\\test\\output.docx", true); } catch (Exception e) { System.out.println(e.getMessage()); e.printStackTrace(); } } }
Android根据word模板文档将表单数据生成word文档的方案整理
原文:https://www.cnblogs.com/whycxb/p/9799824.html