https://issues.apache.org/bugzilla/show_bug.cgi?id=48415
Yegor Kozlov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |WONTFIX --- Comment #1 from Yegor Kozlov <[email protected]> 2009-12-21 08:30:03 UTC --- I'm re-posting my reply from poi-user: HSSFPicture.resize() as well as XSSFPicture.resize() indeed work only for the default font which is Arial 10pt for .xls and Calibri 11pt for .xlsx. Excel uses a funny coordinate system to position graphic objects. X and Y axes are measured not in pixels but in units proportional to a character width of the default font. To properly position and size an image POI needs to translate the actual dimensions measured in pixels to columns and rows. This is the key of the problem. At the moment POI performs this translation using hardcoded constants obtained empirically for Arial 10pt and Calibri 11pt. It works OK in most cases and also explains why HSSFPicture.resize() is 'off' if the default font is changed. Unfortunately it can not be easily fixed. To measure a custom font POI needs to load it (i.e. the font must be physically available) and get the font metrics using java.awt.* utilities. It will make the result machine dependent and impossible to test. I updated the javadocs on HSSFPicture.resize() to reflect it. Yegor -- 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]
