Java 使用某些版本的Office 10打开docx4j保存的文件时出错
我已经使用以下单元测试创建了文档Java 使用某些版本的Office 10打开docx4j保存的文件时出错,java,ms-office,docx4j,Java,Ms Office,Docx4j,我已经使用以下单元测试创建了文档 @Test public void testConvert() throws Docx4JException { WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage(); wordMLPackage.getMainDocumentPart().addParagraphOfText("hello"); // Now save it
@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") );
}
但是,我在使用某些版本的Microsoft Office 10 for home and business(版本14.0.6112.5000)打开此文件时出错(文件已损坏)。同时,它可以与最新版本的Microsoft Office 10、Open Office、Office365和Liber Office配合使用
是否有任何方法可以解决此问题,以便能够使用任何版本的Office 10打开文档。
谢谢您的问题可能是docx4j.properties属性: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!
确保该值为3.2或3.3,而不是3.2.1
或者设置docx4j.App.write=false您的问题可能是docx4j.properties属性: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!
确保该值为3.2或3.3,而不是3.2.1
或者设置docx4j.App.write=false谢谢docx4j.AppVersion=3.3帮助谢谢谢谢谢谢docx4j.AppVersion=3.3帮助谢谢