Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create docx file using java?

Tags:

java

file

docx

I am trying to create a .docx file using java but for some reason I can't open the file. The error comes "Problem with the content of file". Does anyone knows how to fix this problem?

like image 410
Vighanesh Gursale Avatar asked Oct 15 '12 13:10

Vighanesh Gursale


People also ask

How do I make a file a DOCX?

Select the folder where you want to save your document. The dialog box will open > Select "Save as" > In the "Save as type" menu > Select the option "Word document (. docx)" > Click on the "Save as" button and a copy of your file will be saved in Docx format. I hope the information is useful.

What is Java DOCX?

Docx4j is a Java library used for creating and manipulating Office OpenXML files – which means it can only work with the . docx file type, while older versions of Microsoft Word use a . doc extension (binary files). Note that the OpenXML format is supported by Microsoft Office starting with the 2007 version.


2 Answers

Tried multiple libraries

This one is free. http://www.docx4java.org/trac/docx4j

Also check aspose (is not free) http://www.aspose.com/categories/java-components/aspose.total-for-java/default.aspx

like image 118
StanislavL Avatar answered Oct 21 '22 16:10

StanislavL


you may use http://poi.apache.org/ to create such files.

like image 25
maxstreifeneder Avatar answered Oct 21 '22 15:10

maxstreifeneder