0

I want to be able to generate .docx files through either Java or Python based off of a template .docx file. I need to be able to insert in simple text, some bullets and a table or two.

I would like suggestions on specific libraries/modules for either Python or Java that would allow me to load a template, insert basic text and tables and then save it.

I have been looking into JACOB for Java and docx for Python. Any alternatives? Or will one of these be able to do what I need?

Thanks in advance

Cole
  • 349
  • 5
  • 16

3 Answers3

1

Give docx4j as a choice, it's based on Apache POI but with better documentation

heroandtn3
  • 164
  • 1
  • 7
1

If you want to generate a docx, than you might like docxtemplater, which is a library I maintain which does docx generation from a template (much like Mustache for HTML).

It runs on node but has a command line interface so you can use it from any language.

DocxTemplater Library

Demo Site

edi9999
  • 19,701
  • 13
  • 88
  • 127
  • Just so you are aware, the pictures are broken at the Demo Site link. – Cole Jun 02 '14 at 19:21
  • Interesting. I am fairly new to coding so could you explain how to use the command line interface from within java? This looks like the best option since it can handle bullets and tables. – Cole Jun 02 '14 at 19:36
  • I never coded java but here is a so question about running command line with java https://www.google.de/url?sa=t&source=web&rct=j&ei=comNU_SKPOmB4gTEpIDACQ&url=http://stackoverflow.com/questions/8496494/running-command-line-in-java&cd=1&ved=0CCQQFjAA&usg=AFQjCNEc3A_Na33bK-uY_pvE2c2-VE0DNw – edi9999 Jun 03 '14 at 08:39
0

Did you look at Aapache POI (the Java API for Microsoft Documents) project?

http://poi.apache.org/

Good luck!

Danyu
  • 509
  • 3
  • 7
  • I seemed to me that it was more meant for excel. I didn't know if it was capable of dealing with tables. I will look further into it however. – Cole Jun 02 '14 at 15:35
  • Sorry that I only used it for Excel, but it should work for word as well. Please refer to this discussion http://stackoverflow.com/questions/13507424/how-to-create-a-word-document-using-apache-poi – Danyu Jun 02 '14 at 15:41