Hi, I'm having this NullPointerException trying to convert a docx to html:
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
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, ...