Evgen
Evgen

Reputation: 1338

Error while openning of saved by docx4j files with some version of Office 10

I've created document using following unit test

@Test
public void testConvert() throws Docx4JException 
{

WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
wordMLPackage.getMainDocumentPart().addParagraphOfText("hello");            
// Now save it 
wordMLPackage.save(new java.io.File("/home/user/DocX/sample.docx") );
}

But I have error (file corrupted) while opening this file with some versions of Microsoft Office 10 for home and business (version 14.0.6112.5000). At the same time it works fine with latest versions of Microsoft Office 10, Open Office, Office365 and Liber Office.

Is there any way to fix this problem to be able to open document with any version of Office 10. Thanks

Upvotes: 0

Views: 848

Answers (1)

JasonPlutext
JasonPlutext

Reputation: 15878

Probably your problem is docx4j.properties property: docx4j.AppVersion

docx4j.AppVersion=3.3
# of the form XX.YYYY where X and Y repre**strong text**sent numerical values
# WARNING: -SNAPSHOT will cause Word 2010 x64 to treat the docx as corrupt!

Make sure the value is 3.2 or 3.3, rather than say 3.2.1

or set docx4j.App.write=false

Upvotes: 2

Related Questions