maybe this question is quite easy to answer and a bit stupid but for now google was not quite able to help me.
I have a docx-file where I search for a certain paragraph with xpath containing a certain text.
- Code: Select all
String xpath = "//w:p[w:r[w:t[contains(text(),'"+$example$+"')]]]";
The corresponding list just contains one entry which I want to replace like this:
- Code: Select all
list.set(0, newContent);
(newContent is an Object containing new paragraphs. I got this Object from unmarshalling a string descriping my new paragraphs)
While investigating the internet I found an entry that if I'd change the result within the list it is directly altered within the document. So my idea was just to create a new Object an replace the on within the list. But if I save afterwards and try to open the docx-file nothing changed.
All in all my idea is to locate one paragraph within my docx-file and replace it by many others depending on how much results I got from a previous computing step.
I would be very grateful for every help!
Best wishes.