I think that your only recourse now would be to raise this as a bug using bugzilla George.
If you can. list the version of POI you are using, the version of Java and the operating system. Include an Excel file that demonstrates the problem and the code required to reproduce if. Also, it would be worth explaining again the preliminary investigations you undertook. That way the developers should have all of the ammunition they need to address the issue. Sorry I could not help. Yours Mark B PS Looks like I will need to re-visit that example again. George Wei wrote: > > Mark, > > Thanks for your reply, but I don't mean what you said. > > I re-explain my test steps here: > > 1.1 Use Excel to new an Excel workbook > 1.2 Use POI to open it and insert an image > 1.3 Call HSSFPicture.resize() > 1.4 Save and close it > > 2.1 Use Excel to new an Excel workbook > 2.2 Use Excel to modify the default font size (For example, from 10 to 20) > 2.3 Save and close it > 2.4 Use POI to oepn it and insert the same image used in the previous test > 2.5 Call HSSFPicture.resize() > 2.6 Save and close it > > Now, use Excel to open these two workbooks, as illustated in prevous > threads, you can see the same image in these workbooks do NOT have the > same size! The later one stretchs horizontally! > > BTW, I tried the code you mentioned, but it still only works when the > default font size not changed yet. > > George > > > MSB wrote: >> >> Sorry to say George that I have not encountered this specific problem but >> do wonder if it is related to the type of client anchor that HSSF uses. >> These anchors seem to tie an image to a specific cell whereas using Excel >> itself, it is possible to identify the coordinates of the images corners >> along with inset values also. Tying the image directly to the cell means >> that when the cell is re-sized then so is the image and I think that this >> is what is happening in your case - changing the size of the default font >> causes Excel to increase the width and height of the sheets cells when it >> opens the worksheet. Sorry to say that I cannot think of an easy answer >> because Excel is resizing the columns rather than POI but if it helps you >> could take a look at some code I wrote quite some time ago. It allows you >> to add an image onto a sheet and to specify the location of the image and >> its' dimensions. you can find it all here; >> http://svn.apache.org/viewvc/poi/trunk/src/examples/src/org/apache/poi/hssf/usermodel/examples/AddDimensionedImage.java?revision=805284&view=markup >> >> Do not know if it will work for your requirement and it certainly does >> not answer your question but you may be able to use this class to get you >> over the current problem. >> >> Yours >> >> Mark B >> >> >> George Wei wrote: >>> >>> There are no comments from neither developers nor users for several >>> days. Hasn't anybody encountered this problem except me? >>> >>> >>> George Wei wrote: >>>> >>>> Dear all, >>>> >>>> As my test result, this function only works when the default font size >>>> of workbook not changed. If I modified its size (For example, from 12 >>>> to 22) and then call this function to insert an image, it stretchs >>>> horizontally. >>>> >>>> Image 1 (Default font size set to 12): >>>> http://old.nabble.com/file/p26738706/1.jpg >>>> >>>> Image 2 (Default font size set to 22): >>>> http://old.nabble.com/file/p26738706/2.jpg >>>> >>>> I've checked the source code of HSSFPicture.java, function resize() >>>> calls another function getPixelWidth() to calculate the column width in >>>> pixels, but the later function only works correctly when the default >>>> font size of workbook not changed. >>>> >>>> Can somebody give me some suggestions to correct this problem? Thanks. >>>> >>>> George >>>> >>> >>> >> >> > > -- View this message in context: http://old.nabble.com/Bug-of-HSSFPicture.resize%28%29-tp26738706p26861591.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
