Bug 43700

Summary: HFFSPicture.getPrefferedSize() doesn't work very well
Product: POI Reporter: damiano biagioli <damiano_biagioli>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED WONTFIX    
Severity: enhancement    
Priority: P3    
Version: 3.0-dev   
Target Milestone: ---   
Hardware: All   
OS: other   

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