poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 54969] New: XSSFTextBox doesn't behave properly
Date Tue, 14 May 2013 15:36:44 GMT
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


Mime
View raw message