You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2013/05/14 17:36:44 UTC

[Bug 54969] New: XSSFTextBox doesn't behave properly

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

            Bug ID: 54969
           Summary: XSSFTextBox doesn't behave properly
           Product: POI
           Version: 3.9
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: sanewell92@gmail.com
    Classification: Unclassified

Created attachment 30284
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30284&action=edit
Class demonstrating the bug

See semi-solved Stack Overflow question : 

http://stackoverflow.com/questions/16529787/how-to-change-font-on-xssftextbox


So two things, one has a fairly easy work-around and the other is just
annoying: Firstly (easy work-around but limiting) I have to retrieve the
underlying CTTextCharacterProperties object to actually change the font, which
is strange in the first place; as the other guy on SO said, it seems like the
XSSFSimpleShape.applyAttributes method doesn't deal with Fonts correctly, but
rather only Font Families, which is not what is expected when applying a Font
to a RichTextField to use it as the text for an XSSFTextBox; I expect that
applied Font to be correctly and fully applied, not to mention that the only
colors that seem to be applied are Font.COLOR_NORMAL and Font.COLR_RED enums.
Unless this is what you want us to use, which documentation never says to; I
would normally simply create a new XSSFColor(java.awt.Color.BLACK) like I do
with fonts and styles for cells, but that does not work here (I always would
get white color default font when I try and do it intuitively).

Second, with Excel 2010 when I call setFillColor on an XSSFTextBox object upon
opening the spreadsheet Excel tells me that it found unreadable content and
then it repairs xml, specifically
"Repaired Records: Drawing from /xl/drawings/drawing1.xml part (Drawing shape)"

If I comment out setFillColor I don't get this bit. I've also tried using the
underlying CTTextCharacterProperties Object to fill the TextBox, making a
reference Object rpr from a XSSFTextBox instance call
getCTShape().getTxBody().getPArray(0).getRArray(0).getRPr(), I then do this :
Color col = Color.PINK; and invoke
rpr.addNewSolidFill().addNewSrgbClr().setVal(); and pass in a new byte array
from values from col. This does not fill the XSSFTextBox, and it makes excel
find unreadable content as well, so at the moment I use setFillColor, but I
can't have excel finding unreadable content as the users who will be using my
program won't know what is happening and think something went wrong.


Thanks for taking the time to read this! I'm not sure if this is an Excel 2010
specific thing, or if I'm calling/dealing with XSSFTextBox incorrectly, or
what; attaching source code.

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


[Bug 54969] XSSFTextBox doesn't behave properly

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54969

Darren Roberts <ro...@yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |robertsdjguard-poidev@yahoo
                   |                            |.com

--- Comment #1 from Darren Roberts <ro...@yahoo.com> ---
Created attachment 30603
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=30603&action=edit
Patch which fixes the font issue and implements unit test verifying that the
font and color attributes are passed through correctly

I've attached a patch which fixes the font issue and implements unit test
verifying that the font and color attributes are passed through correctly.

I suspect your other problem is related to shape groups - do you see the same
issue if you create the textboxes as indivdual entities?

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