docx4j open odt files

1.3k views Asked by At

Im trying to convert word files to pdf using docx4j, so far i have successfully converted doc and docx files, but when i try to load an odt file i get InvalidFormatException: Bad [Content_Types].xml and by opening the odt file with zip, i can see a content.xml file (but not a content_types.xml)

this is how im doing to load the file:

 WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));
2

There are 2 answers

1
JasonPlutext On

An odt file is an OpenOffice/LibreOffice file, not a Microsoft Word OpenXML file.

docx4j doesn't handle odt files.

0
saimiris_devel On

ODT is a different format than OOXML.

.ODT is the word processing file format of Open Document Format for Office Applications (ODF), also known as OpenDocument, this is an XML-based file format for spreadsheets, charts, presentations and word processing documents.

Office Open XML (OOXML) is an XML-based file format used for representing word processing documents, spreadsheets, and presentations (.docx, .xlsx, and .pptx). It is conceptually similar to ODF in many respects, though a lot of the details differ. OOXML was created by Microsoft and has been used as the default format in all versions of Office since 2007.

ODF vs OOXML is an ongoing war of standards, you should document yourself about it.