Bug 52745

Summary: XSSFRichTextString append method looses leading/trailing spaces
Product: POI Reporter: Guerrero <guerrero747>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: minor    
Priority: P2    
Version: 3.8-dev   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Diff for method append on XSSFRichTextString

Description Guerrero 2012-02-23 11:15:51 UTC

    
Comment 1 Guerrero 2012-02-23 11:25:09 UTC
Created attachment 28371 [details]
Diff for method append on XSSFRichTextString
Comment 2 Guerrero 2012-02-23 11:26:01 UTC
In our development we needed to append to a XSSFRichTextString multiple substrings each one with different font, so we used the append method. There was a problem because it removes the leading / trailing spaces and joined words. 

For example:


XSSFRichTextString text = cell.getRichStringCellValue();
text.append("Hello ");
text.append("World!");

Makes "HelloWorld!" 

and

text.append("Hello");
text.append(" World!");

also makes "HelloWorld!" 

We have modified the append method to call preserveSpaces and get "Hello World!"
Comment 3 Yegor Kozlov 2012-02-23 12:08:42 UTC
Applied in r1292759 along with a unit test.

Regards,
Yegor