poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 59098] New: XSSFRichTextString.append(string) applies font incorrectly
Date Wed, 02 Mar 2016 13:20:03 GMT

            Bug ID: 59098
           Summary: XSSFRichTextString.append(string) applies font
           Product: POI
           Version: 3.13-FINAL
          Hardware: Other
                OS: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: jmarkmurph@yahoo.com

XSSFRichTextString.append(string) works correctly if the value of the
XSSFRichTextString is empty. However if a different font has been applied to a
section of the text, it applies a font, I believe the default font, which is
wrong (different from the way Excel works). append(string) should append a
string without a font which will allow the text to use the cell style to
determine the font. See the following example XML generated by 

XSSFRichTextString rts = new XSSFRichTextString();
rts.append("This is correct ");
rts.append("This is Bold Red", BoldRed);
rts.append(" This uses the default font rather than the cell style font");

    <t xml:space="preserve">This is correct </t>
      <sz val="11"/>
      <color indexed="10"/>
      <rFont val="Calibri"/>
      <family val="2"/>
    <t>This is Bold Red</t>
      <sz val="11"/>
      <color indexed="8"/>
      <rFont val="Calibri"/>
      <family val="2"/>
      <scheme val="minor"/>
    <t xml:space="preserve"> This uses the default font rather than the cell
style font</t>

You can clearly see the three text groupings added by the three append methods.
The first does not include a font, and consequently does not include an <rPr>
node. The second does include a font, and does include an <rPr> node. However,
the third append does not include a font, and thus should not include an <rPr>
node. In Excel If I take this string, and bold red the date string in the
middle of it, the two other strings have no <rPr> nodes, which is what I
expected. The result is that if the cell style uses other than the default
font, only the first append(string) method will add text that uses the font in
the cell style. Any append(string) methods called after an append(string, font)
call will explicitly use the spreadsheet default font.

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

View raw message