You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Rob <ry...@harris.com> on 2012/12/21 22:30:02 UTC

Modifications to HSSFPicture - what do do about XSSFPicture?

Back when I was first working with HSSF, I couldn't find a way to do a
'fitToRect' operation on an HSSFPicture, so I wrote my own - essentially cloning
and modifying the resize() logic to scale a picture to fit within a rectangle of
rows and character cells without distorting its shape.  Trickier than it sounds,
since I also wanted the resulting picture centered in the requested rectangle.

I use this to insert differently shaped logos into a reserved rectangle in
report headers and to put checkmark glyps, etc into cells.  I'd love for this
functionality to be added to POI - if only so I wouldn't have to worry about
maintaining it.  But that's not my question (yet).

I'm thinking of changing my code to support XSSF as well as HSSF, and before I
dig into the differences between XSSFPicture and HSSFPicture (or more
specifically their respective ClientAnchor's, I'm wondering...

1. Does anybody know if the internal stuff for pictures in XSSF is completely
different than for HSSF (i.e., is this likely to be doable for XSSF)?

2. How would I go about suggesting native POI support for a Picture.fitToRect()
function (including sharing how I implemented it - if that helps)?

3. I'm not a serious Java programmer, and I couldn't figure out how to simply
'extend' the HSSFPicture functionality, so I ended up having to clone some of
the private HSSFPicture methods used by resize() in order to build my
fitToRect() variant. Is there an easy way in java to extend HSSFPicture and get
access to its private stuff?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org