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

           Summary: Applying Font to XSSFRichTextString looses non
                    leading/trailing spaces.
           Product: POI
           Version: 3.6
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: [email protected]
        ReportedBy: [email protected]


If a create an XSSFRichTextString as follows:

RichTextString text = workbook.getCreationHelper().createRichTextString( "Test
String" ) ;

and apply formatting to the first 4 characters "Test":

text.applyFont( 0 , 4 , FONT ) ;

then the remaning text " String" loses its leading white space when rendered in
Excel.

the generated Open XML sharedStrings.xml contains the following:

- <si>
- <r>
- <rPr>
  <u val="single" /> 
  <sz val="11.0" /> 
  <rFont val="Calibri" /> 
  </rPr>
  <t>Test</t> 
  </r>
- <r>
  <t> String</t> 
  </r>
  </si>

The leading space is present but the XML space preserving attribute needs to be
set as follows:

- <si>
- <r>
- <rPr>
  <u val="single" /> 
  <sz val="11.0" /> 
  <rFont val="Calibri" /> 
  </rPr>
  <t>Test</t> 
  </r>
- <r>
  <t xml:space="preserve"> String</t> 
  </r>
  </si>

This is not currently possible that I can see in the POI libraries unless I am
missing something? If no formatting is applied to the XSSFRichTextString then
the XML preserve space attribute is set but when being split for formatting it
does not seem to be accessible.

-- 
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]

Reply via email to