0

I have to read a .doc or a .docx document with some static fields like title, header with a program written in Java. With the same program a user fills a form (GUI) and all these infos should be added in the right place in the document previously read.

Which framework is most suitable for my work?

Kara
  • 6,115
  • 16
  • 50
  • 57
rocker
  • 77
  • 9
  • What about [`Apache POI - the Java API for Microsoft Documents`](http://poi.apache.org/)? – Smit Jul 03 '13 at 23:01
  • if there's the possibility to read a document previously built and then add other info it's perfect for my purpose . thanks – rocker Jul 04 '13 at 11:54
  • http://stackoverflow.com/questions/17693553/how-to-insert-data-into-a-microsoft-word-template-using-java/17716451#17716451 –  Jul 22 '13 at 04:20

1 Answers1

0

See apache-poi-or-docx4j-for-dealing-with-docx-documents

For techniques relating to adding text into a document, see document-generation

docx4j works mainly with docx (and pptx, xlsx) files. As far as legacy binary docs are concerned, you have a couple of options:

  • use POI's HWPF support. This is included in docx4j as a dependency. But its not a great approach, since it doesn't convert the doc to docx4j's internal representation:- you're kinda stuck in HWPF land

  • use JODConverter to convert the doc to a docx, and if necessary, back again. This is the best way to go.

Community
  • 1
  • 1
JasonPlutext
  • 15,352
  • 4
  • 44
  • 84