I am performing text substitution, by replacing existing text with new text. While doing so i am deleting existing text completely from a text run. This results into the text run ending with a space, example : <w:t>This is </w:t>
After the word "is" there is a space which does not get displayed in the resulting docx.
When i manually add the property, xml:space="preserve" to this text run, the space gets displayed.
How do i preserve this (leading or trailing) space using docx4j after substitution? How do i add the xml:space="preserve" property programmatically to the text run?