aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java23
-rw-r--r--src/java/org/apache/poi/ss/usermodel/Sheet.java20
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java25
-rw-r--r--src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java3
-rw-r--r--src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java1
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java1
6 files changed, 72 insertions, 1 deletions
diff --git a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
index 3aa609d753..83003a7366 100644
--- a/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
+++ b/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java
@@ -1233,6 +1233,7 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
*
* @param numerator The numerator for the zoom magnification.
* @param denominator The denominator for the zoom magnification.
+ * @deprecated 2015-11-23 (circa POI 3.14beta1). Use {@link #setZoom(int)} instead.
*/
@Override
public void setZoom(int numerator, int denominator) {
@@ -1246,6 +1247,28 @@ public final class HSSFSheet implements org.apache.poi.ss.usermodel.Sheet {
sclRecord.setDenominator((short) denominator);
getSheet().setSCLRecord(sclRecord);
}
+
+ /**
+ * Window zoom magnification for current view representing percent values.
+ * Valid values range from 10 to 400. Horizontal & Vertical scale together.
+ *
+ * For example:
+ * <pre>
+ * 10 - 10%
+ * 20 - 20%
+ * ...
+ * 100 - 100%
+ * ...
+ * 400 - 400%
+ * </pre>
+ *
+ * @param scale window zoom magnification
+ * @throws IllegalArgumentException if scale is invalid
+ */
+ @Override
+ public void setZoom(int scale) {
+ setZoom(scale*100, 100);
+ }
/**
* The top row in the visible view when the sheet is
diff --git a/src/java/org/apache/poi/ss/usermodel/Sheet.java b/src/java/org/apache/poi/ss/usermodel/Sheet.java
index 7aaffc2575..14548bc89d 100644
--- a/src/java/org/apache/poi/ss/usermodel/Sheet.java
+++ b/src/java/org/apache/poi/ss/usermodel/Sheet.java
@@ -581,8 +581,28 @@ public interface Sheet extends Iterable<Row> {
*
* @param numerator The numerator for the zoom magnification.
* @param denominator The denominator for the zoom magnification.
+ * @deprecated 2015-11-23 (circa POI 3.14beta1). Use {@link #setZoom(int)} instead.
*/
void setZoom(int numerator, int denominator);
+
+ /**
+ * Window zoom magnification for current view representing percent values.
+ * Valid values range from 10 to 400. Horizontal & Vertical scale together.
+ *
+ * For example:
+ * <pre>
+ * 10 - 10%
+ * 20 - 20%
+ * ...
+ * 100 - 100%
+ * ...
+ * 400 - 400%
+ * </pre>
+ *
+ * @param scale window zoom magnification
+ * @throws IllegalArgumentException if scale is invalid
+ */
+ public void setZoom(int scale);
/**
* The top row in the visible view when the sheet is
diff --git a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
index 4fd9da7392..70a4f7f20a 100644
--- a/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
+++ b/src/ooxml/java/org/apache/poi/xssf/streaming/SXSSFSheet.java
@@ -776,12 +776,37 @@ public class SXSSFSheet implements Sheet, Cloneable
*
* @param numerator The numerator for the zoom magnification.
* @param denominator The denominator for the zoom magnification.
+ * @deprecated 2015-11-23 (circa POI 3.14beta1). Use {@link #setZoom(int)} instead.
*/
@Override
public void setZoom(int numerator, int denominator)
{
_sh.setZoom(numerator,denominator);
}
+
+ /**
+ * Window zoom magnification for current view representing percent values.
+ * Valid values range from 10 to 400. Horizontal & Vertical scale together.
+ *
+ * For example:
+ * <pre>
+ * 10 - 10%
+ * 20 - 20%
+ * ...
+ * 100 - 100%
+ * ...
+ * 400 - 400%
+ * </pre>
+ *
+ * Current view can be Normal, Page Layout, or Page Break Preview.
+ *
+ * @param scale window zoom magnification
+ * @throws IllegalArgumentException if scale is invalid
+ */
+ @Override
+ public void setZoom(int scale) {
+ _sh.setZoom(scale);
+ }
/**
* The top row in the visible view when the sheet is
diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
index 856b8fcc3e..7ffe736014 100644
--- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
+++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFSheet.java
@@ -2620,7 +2620,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
*
* @param numerator The numerator for the zoom magnification.
* @param denominator The denominator for the zoom magnification.
- * @see #setZoom(int)
+ * @deprecated 2015-11-23 (circa POI 3.14beta1). Use {@link #setZoom(int)} instead.
*/
@Override
public void setZoom(int numerator, int denominator) {
@@ -2647,6 +2647,7 @@ public class XSSFSheet extends POIXMLDocumentPart implements Sheet {
* @param scale window zoom magnification
* @throws IllegalArgumentException if scale is invalid
*/
+ @Override
public void setZoom(int scale) {
if(scale < 10 || scale > 400) throw new IllegalArgumentException("Valid scale values range from 10 to 400");
getSheetTypeSheetView().setZoomScale(scale);
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
index e22f169726..34e5ae4960 100644
--- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
+++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFSheet.java
@@ -408,6 +408,7 @@ public final class TestXSSFSheet extends BaseTestSheet {
workbook.close();
}
+ @SuppressWarnings("deprecation")
@Test(expected=IllegalArgumentException.class)
public void setZoom() throws IOException {
XSSFWorkbook workBook = new XSSFWorkbook();
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
index c7298fda21..fed4bc5466 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFSheet.java
@@ -517,6 +517,7 @@ public final class TestHSSFSheet extends BaseTestSheet {
workbook.close();
}
+ @SuppressWarnings("deprecation")
@Test
public void zoom() throws IOException {
HSSFWorkbook wb = new HSSFWorkbook();