From: Yegor Kozlov
resize(1.0)
sets the original size, resize(0.5)
resize to 50% of the original,
@@ -103,6 +108,12 @@ public final class HSSFPicture extends HSSFSimpleShape implements Picture {
/**
* Reset the image to the original size.
+ *
+ * + * Please note, that this method works correctly only for workbooks + * with default font size (Arial 10pt for .xls). + * If the default font is changed the resized image can be streched vertically or horizontally. + *
*/ public void resize(){ resize(1.0); diff --git a/src/java/org/apache/poi/ss/usermodel/Picture.java b/src/java/org/apache/poi/ss/usermodel/Picture.java index e816c9ac15..1959cad0ce 100644 --- a/src/java/org/apache/poi/ss/usermodel/Picture.java +++ b/src/java/org/apache/poi/ss/usermodel/Picture.java @@ -25,12 +25,24 @@ public interface Picture { /** * Reset the image to the original size. + * + *+ * Please note, that this method works correctly only for workbooks + * with default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx). + * If the default font is changed the resized image can be streched vertically or horizontally. + *
*/ void resize(); /** * Reset the image to the original size. * + *+ * Please note, that this method works correctly only for workbooks + * with default font size (Arial 10pt for .xls and Calibri 11pt for .xlsx). + * If the default font is changed the resize() procedure can be 'off'. + *
+ * * @param scale the amount by which image dimensions are multiplied relative to the original size. *resize(1.0)
sets the original size, resize(0.5)
resize to 50% of the original,
* resize(2.0)
resizes to 200% of the original.
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPicture.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPicture.java
index 12f6b064de..66a6d9c5a7 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPicture.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFPicture.java
@@ -149,6 +149,12 @@ public final class XSSFPicture extends XSSFShape implements Picture {
/**
* Reset the image to the original size.
+ *
+ * + * Please note, that this method works correctly only for workbooks + * with the default font size (Calibri 11pt for .xlsx). + * If the default font is changed the resized image can be streched vertically or horizontally. + *
*/ public void resize(){ resize(1.0); @@ -156,6 +162,11 @@ public final class XSSFPicture extends XSSFShape implements Picture { /** * Reset the image to the original size. + *+ * Please note, that this method works correctly only for workbooks + * with the default font size (Calibri 11pt for .xlsx). + * If the default font is changed the resized image can be streched vertically or horizontally. + *
* * @param scale the amount by which image dimensions are multiplied relative to the original size. *resize(1.0)
sets the original size, resize(0.5)
resize to 50% of the original,