Bug 43700 - HFFSPicture.getPrefferedSize() doesn't work very well
Summary: HFFSPicture.getPrefferedSize() doesn't work very well
Status: RESOLVED WONTFIX
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: All other
: P3 enhancement (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-10-26 01:40 UTC by damiano biagioli
Modified: 2007-11-03 12:57 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description damiano biagioli 2007-10-26 01:40:02 UTC
hello . I was using the apache poi hssf library (the 3.0.2), in order to include
an image in an externally generetad image .  my code is omething like : 
 HSSFPicture picture = patriarch.createPicture(new HSSFClientAnchor(),
loadPictureFromFilesystem(picturePath, wb ));
   HSSFClientAnchor prefferedSize = picture.getPrefferedSize();
picture.setAnchor(prefferedSize);

the problem is , under the image there is a table with some very large cells . 

So, the assumption made in 
http://svn.apache.org/repos/asf/poi/trunk/src/java/org/apache/poi/hssf/usermodel/HSSFPicture.java

that is ,
int cellwidth = 64;
int rowheight = 17;

is no more true . as a result, the image is distorted
Comment 1 Yegor Kozlov 2007-10-26 02:04:35 UTC
HFFSPicture.getPreferredSize() calculates anchor for the default grid. If you
insert an image, add cells below it and some of the cells are large then the
image gets resized. It's a natural behavior, there is nothing to enhance. 

Can you post a code snippet?   

BTW, there is silly typo in the method signature. it should be
HFFSPicture.getPreferredSize (), not HFFSPicture.getPrefferedSize(). I'm going
to change it. 

Yegor