How to remove special characters and STYLEREF text?

Hi,
I have the following text in word “Figure 1-1: Concept of ABC”. However when I do the node.getText() on this node, it gets parsed as "Figure STYLEREF 1 \s 1- SEQ Figure * ARABIC \s 1 1: Concept of ABC".

How can I avoid added STYLEREF and special characters ? I want it to parse as "Figure 1-1: Concept of ABCSample.zip (13.2 KB)
" only.

@manandmehta,

Thanks for your inquiry. Please use Node.toString(SaveFormat.TEXT) method to get the desired output.

Document doc = new Document(MyDir + "Sample.docx");
System.out.println(doc.getFirstSection().getBody().getFirstParagraph().toString(SaveFormat.TEXT));

That solved my problem. Thank you for your prompt reply.