java.lang.NullPointerException
at org.docx4j.model.PropertyResolver.init(PropertyResolver.java:193)
at org.docx4j.model.PropertyResolver.<init>(PropertyResolver.java:161)
at org.docx4j.openpackaging.parts.WordprocessingML.MainDocumentPart.getPropertyResolver(MainDocumentPart.java:177)
My java code is
- Code: Select all
public static String convert2HTML(File docxFile, String target) throws Exception {
String fileName = removeFileExtension(docxFile) + ".html";
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(docxFile);
try {
wordMLPackage.getMainDocumentPart().getPropertyResolver();
} catch (Exception e) {
LoggerManager.getLogger(Docx4jUtils.class).error("Error", e);
return "error/propertyResolver.html";
}
AbstractHtmlExporter exporter = new HtmlExporterNG2();
// note the *2* there
// Write to StreamResult (in this case, an output stream)
OutputStream os = new java.io.FileOutputStream(target + fileName);
javax.xml.transform.stream.StreamResult result
= new javax.xml.transform.stream.StreamResult(os);
exporter.html(wordMLPackage, result, target + "_files");
return fileName;
}
I hope you guys can help me.