We are using Aspose Word to split document using heading & convert the same in HTML. However, its throwing following error:
java.lang.IllegalStateException
at com.aspose.words.zzZS2.endElement(Unknown Source)
at com.aspose.words.zzZVT.zzZTP(Unknown Source)
at com.aspose.words.zzZVT.zzJ(Unknown Source)
at com.aspose.words.zzZJA.visitParagraphStart(Unknown Source)
at com.aspose.words.Paragraph.zzZ(Unknown Source)
at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
at com.aspose.words.Paragraph.accept(Unknown Source)
at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
at com.aspose.words.Body.accept(Unknown Source)
at com.aspose.words.zzZVT.zzZA(Unknown Source)
at com.aspose.words.zzZVT.zzZ(Unknown Source)
at com.aspose.words.zzZVT.zzZTS(Unknown Source)
at com.aspose.words.zzZVT.zzZU3(Unknown Source)
at com.aspose.words.zzZRD.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
<span lang="HU" style="font-size:10.0pt;font-family:Courier;mso-fareast-font-family:
Calibri;mso-fareast-theme-font:minor-latin;mso-bidi-font-family:"Times New Roman";
color:red;mso-ansi-language:HU;mso-fareast-language:HU;mso-bidi-language:AR-SA">
at
routines.com_ge_datacoe_confluence.splitDocument(com_ge_datacoe_confluence.java:610)
PFB code we used:
public static void splitDocument(String documentLoc, String fileName, String outputLoc) throws Exception {
log.warn("Loading document from " +documentLoc+ " with name: " + fileName);
// System.out.println("Loading document from " +documentLoc+ "....");
Document doc = new Document(documentLoc);
// In case draft mode, accept all revisions & update document
doc.acceptAllRevisions();
log.warn("Loaded succesfully document from " +documentLoc+ " with name: " + fileName);
HtmlSaveOptions options = new HtmlSaveOptions();
options.setDocumentSplitCriteria(DocumentSplitCriteria.HEADING_PARAGRAPH);
options.setDocumentSplitHeadingLevel(1);
options.setExportHeadersFootersMode(ExportHeadersFootersMode.NONE);
log.warn("Saving document to " +outputLoc+ " with name: " + fileName);
doc.save(outputLoc + "/" + fileName + ".html", options);
log.warn("Saved successfully document to " +outputLoc+ " with name: " + fileName);
}
Looks like this is an issue in API.
Thanks & Regards,
Karunesh. S