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