I have a Docx4j Word Template using bookmarks to populate text when generating the document.
One of the bookmark fields is loaded with text that has new lines /r/n in the string which is supposed to print as new lines.
example:
<w:bookmarkStart w:name="distributionText_1" w:id="31" />
<w:r>
<w:t>cc: This is line 1 This is line 2 with more This is line 3</w:t>
</w:r>
<w:bookmarkEnd w:id="31" />
I can see the /r/n in the string (debug) but prints as;
cc: This is line 1 This is line 2 with more This is line 3
I want it to print as;
cc:
This is Line 1
This is Line 2
This is Line 3
It appears I need to convert the /r/n to a /b in the xml but not sure how to do this.
Code snippet of code I'm using to add to bookmark.
// now add a run
org.docx4j.wml.R run = wmlObjFactory.createR();
if (bmp.getrPr() != null)
run.setRPr(bmp.getrPr());
org.docx4j.wml.Text t = wmlObjFactory.createText();
run.getContent().add(t);
t.setValue(value);
Any code samples for this conversion?
Thanks
Todd