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
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