On Wed, 7 Dec 2011, gipsy wrote:
The Problem is, that you can only replaceText for single runs. But what happens, if your whole word (for example word_to_replace ') is not placed in one run, but in more than one run. Then, the API don't know your word and can not replace it.

Correct. It works on single runs only, as it's a methon on a given run

I guess the solution is to add a replace method on the paragraph too. The logic would need to be something like:
* If it's all in one run, replace it
* If it spans two runs, change it in the first, delete from the second
* If it is partly in one run, and the rest finishing a 2nd, change in
  the first and delete the 2nd

I had to build a workaround and saved in which run the 'word_to_replace'
begins and in which run it ends (for example in run 10 it begins and in run
13 it ends).
=> So I inserted the 'new_text' inside the first run 10 and for the
following 11-13 I inserted an empty string "".

It sounds like you have most of this logic already, are you able to work up a patch + unit test for XWPFParagraph for this?

Nick

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to