https://issues.apache.org/bugzilla/show_bug.cgi?id=48877
Yegor Kozlov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution| |FIXED --- Comment #7 from Yegor Kozlov <[email protected]> 2011-06-25 08:46:47 UTC --- Fixed in r1139505 XSSFRichTextString didn't respect leading or trailing line breaks. The problem was in how POI preserved space characters: each format run is represented by a xml element and if a run starts or ends with a space, it is important to set the xml:space="preserve" attribute, otherwise XML serializer will strip the space off. The old code properly handled the whitespace character (' '), but not line breaks (actually any characters from the 'space' family should be preserved - line breaks, tabs, etc.). The old code looked something like this: if (text.startsWith(" ") || text.endsWith(" ")) { // set xml:space="preserve" } It evidently ignored line breaks. I changed it as follows and it did the trick: if(Character.isWhitespace(firstChar) || Character.isWhitespace(lastChar)) { // set xml:space="preserve" } Yegor -- 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: [email protected] For additional commands, e-mail: [email protected]
