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

Free Support Forum - aspose.com

How to convert MathType equation to Office Math equation using Java

Hi Team,

i am using aspose word java , i used to iterate the paragraph which is present in the word document and read the paragraph to string format (eliminate field code) for that i am using the below code

public String getParaAsStr(Paragraph para) {
String parastr="";
Iterator NodeList = para.getChildNodes().iterator();
try {
while (NodeList.hasNext()) {
Node aNode = NodeList.next();
if (aNode.getNodeType() == NodeType.RUN) {
if (!aNode.getText().endsWith(ControlChar.LINE_BREAK)) {
parastr = parastr + aNode.toString(SaveFormat.TEXT);
}
else {
parastr = parastr + " ";
}
}
else if (aNode.getNodeType() == NodeType.FIELD_START) {
Node fnode = NodeList.next();
while (fnode.getNodeType() != NodeType.FIELD_SEPARATOR && fnode.getNodeType() != NodeType.FIELD_END) {
fnode = NodeList.next();
}
}
}
}catch(Exception e) {
return parastr;
}
return parastr;

}

when i using the above code to convert paragraph to string the math element which is in shape node convert to space . i want to read the math element as in the paragraph , kindly give the solution to read the math element as it is.

test.zip (26.1 KB)

Thanks,
Kesavaraman

@keshav07

Your document contains MathType equation and it is OLE object. Unfortunately, Aspose.Words does not provide API to convert it to Office Math to get the equation text. For this cae, we have logged new feature as WORDSNET-20976 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.