Page 1 of 1

How to skip <w:instrText> value from TextNode but need <w:t>

PostPosted: Wed Jul 29, 2020 11:27 am
by arulface
Hi,

We were reading the entire docx content by using TraverseUtil. While reading we have been getting values from <w:instrText> node also but we need text only from <w:t>. Please help me.

Details below:
We have been reading the Text node value by using the below piece of code
Text textNode = (Text) o;
String textContent = textNode.getValue();

But this above code brings the content from <w:instrText> tag also but we required text from <w:t> only. Kindly help me.
<w:r>
<w:rPr>
<w:szCs w:val="24"/>
</w:rPr>
<w:instrText>IF "x_+3" "</w:instrText>
</w:r>

-<w:r>
<w:rPr>
<w:szCs w:val="24"/>
</w:rPr>
<w:lastRenderedPageBreak/>
<w:t>We need only w:t text but not from w:instrText</w:t>
</w:r>