I'm trying to replace placeholders in a docx file. I developed the code but I found something tricky. I have a XWPFRun and in debug I can see that the content is
N ${placeholder1}/${placeholder1} of ${placeholder3}
But, when I use run.getText(0), I obtain a substring that does not contain the third placeholder.
However, when I use run.text() and run.toString() methods I get the whole content:
N ${placeholder1}/${placeholder1}\t\t\t\tof ${placeholder3}
Now if I use the getText(0) method I can't replace the third placeholder, while when I tried to use the text() method I obtain
N ${placeholder1}/${placeholder1} of VALUE of ${placeholder3}`
run.setText(run.text().contains(placeholder) ?
run.text().replace(placeholder, placeholderValue) :
run.text(),0);
I use apache poi 3.17