Bug 50717

Summary: Update of rich text runs causing errors
Product: POI Reporter: iset2468
Component: HSLFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: major    
Priority: P2    
Version: 3.7-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: Code snippet showing code that causes error.

Description iset2468 2011-02-03 16:13:58 UTC
Created attachment 26602 [details]
Code snippet showing code that causes error.

When changeTextInRichTextRun(rtRuns[k], updatedText); is called to update the text in a rich text field, the text the following happens:

Scenario 1 (text is the same length as original)
1. POI performs as expected

Scenario 2 (text is updated to be smaller than the original text)
1. Final text in text run (not rich text run) contains the new value plus the end characters from the original text up to the length of the original text
2. The formatting on the entire slide is lost
3. If getText is called on the rich text run, a string index out of bounds error occurs.

Scenario 3 (text is updated to be smaller than the original text)
1. Final text in text run (not in rich text run) contains the truncated new value to the length of the original text
2. The formatting on the entire slide is lost
3. No string index out of bounds error occurs in this case.

Formatting issues only show up when more than 1 rich text run is modified on the same PPT slide line and 1 is modified per scenarios 2 or 3 above.
Comment 1 Andreas Beeker 2015-11-05 00:56:07 UTC
The example is unfortunately incomplete (no ppt attached, not all methods 
defined) and on the other hand the text handling has been rudimentary changed 
... and I guess it now handles your testcase correctly ... so I'm closing this 
for now.

Feel free to reopen the entry, if the trunk version is not working for you.