You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/06/24 16:39:38 UTC

DO NOT REPLY [Bug 45269] but at replaceText function - String index out of range: -5

https://issues.apache.org/bugzilla/show_bug.cgi?id=45269


Fabio Ebner <fa...@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fabioebner@hotmail.com




-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


Re: DO NOT REPLY [Bug 45269] but at replaceText function - String index out of range: -5

Posted by "N. Hira" <nh...@cognocys.com>.
Fabio,

The current version of replaceText() forces you to re-create your  
range after every replacement (using HWPFDocument.getRange() or  
whatever).

I tested this using a slightly modified version of the HWPF.java file  
you attached and it works if I just add the following to your replace  
code:
	para.replaceText("campo1", " foi porraaaaa ", offset);
+	// rebuild the range...
+	range = doc.getRange();

There is another patch attached to bug 45252 that will allow you to  
work without rebuilding the range.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45252

In short:
1.  You can rebuild the range as a work-around
2.  You can use the patch and it will simplify your loop to one  
statement

-h

On 24-Jun-2008, at 9:39 AM, bugzilla@apache.org wrote:

> https://issues.apache.org/bugzilla/show_bug.cgi?id=45269
>
>
> Fabio Ebner <fa...@hotmail.com> changed:
>
>            What    |Removed                     |Added
> ---------------------------------------------------------------------- 
> ------
>                  CC|                            | 
> fabioebner@hotmail.com
>
>
>
>
> -- 
> Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi? 
> tab=email
> ------- You are receiving this mail because: -------
> You are the assignee for the bug.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
>





---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org