Java operation operation Word file, recently spent a few days to solve the problem of exporting data using Word template, collect some information to share.
The common techniques are as follows:
1. POI (Doc, docx file compatible)
Official website: http://poi.apache.org/
Many online examples, due to the release time earlier, many examples of foreign sites, suggest Google search
Bookmark Replace: http://apache-poi.1045710.n5.nabble.com/Replacing-the-value-of-the-bookmarks-td5710052.html
docx file Insert Picture bug fix: https://issues.apache.org/bugzilla/show_bug.cgi?id=49765
DOC file Insert Picture problem: Http://www.coderanch.com/t/466488/open-source/Inserting-table-image-doc-file
Comment: Discussion not in effect ~
Example of a picture replacement for docx template text: http://huangqiqing123.iteye.com/blog/1927761
Comments: The sample code is not particularly complete, and is barely available under simple modifications
......
2. Jacob
: http://sourceforge.net/projects/jacob-project/
Principle Explanation: http://www.ibm.com/developerworks/cn/java/j-lo-jacob/
Because only the Windows platform is supported, and the way COM components are called is suspected of performance issues, no in-depth research ~
3, docx4j
: http://www.docx4java.org/trac/docx4j
Example: http://zhuerg.blog.163.com/blog/static/1404016362014223102843969/
From the name you can see that only the docx file is supported
4, Java2word
Based on Jacob, ...
5, Pageoffice
Official website: http://www.zhuozhengsoft.com/
It looks good, it's powerful.
6, Apose
Official website: http://www.aspose.com/java/word-component.aspx
Heard also commercial charges, Detour ~
In addition, some references to frequently asked questions:
Word to set cell contents to automatically scale fonts
Http://blog.sina.cn/dpool/blog/s/blog_4bb01ea70100az32.html
Java read and write Word file common techniques