We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Office math problem

Hi, I am having a problem with new aspose words 19.2. There is a node I am expecting to be OfficeMath( it was office math in aspose words 17.11) but now its changed to Shape. Can you please check is this ok?
file: AP4326.doc.zip (10.9 KB)

code:

String wordFilePath = "AP4326.doc";
Document doc = new Document(wordFilePath);
Paragraph para = (Paragraph) doc.getChild(NodeType.PARAGRAPH, 3, true);
Run run = (Run) para.getChild(NodeType.RUN, 4, true);	
OfficeMath officeMath = (OfficeMath) run.getNextSibling();

thanks,
Zeljko

@Zeljko

Please use LoadOptions.ConvertShapeToOfficeMath property as shown below to achieve your requirement.

String wordFilePath = MyDir + "AP4326.doc";

LoadOptions loadOptions = new LoadOptions();
loadOptions.setConvertShapeToOfficeMath(true);

Document doc = new Document(wordFilePath, loadOptions);
Paragraph para = (Paragraph) doc.getChild(NodeType.PARAGRAPH, 3, true);
Run run = (Run) para.getChild(NodeType.RUN, 4, true);
OfficeMath officeMath = (OfficeMath) run.getNextSibling();