diff options
Diffstat (limited to 'src/ooxml/java/org/apache/poi/xwpf/usermodel')
-rw-r--r-- | src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java | 19 | ||||
-rw-r--r-- | src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java | 7 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java index 707f142bf3..be206d7398 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java @@ -1199,6 +1199,25 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody { settings.setTrackRevisions(enable); } + + /** + * Returns the current zoom factor in percent values, i.e. 100 is normal zoom. + * + * @return A percent value denoting the current zoom setting of this document. + */ + public long getZoomPercent() { + return settings.getZoomPercent(); + } + + /** + * Set the zoom setting as percent value, i.e. 100 is normal zoom. + * + * @param zoomPercent A percent value denoting the zoom setting for this document. + */ + public void setZoomPercent(long zoomPercent) { + settings.setZoomPercent(zoomPercent);; + } + /** * inserts an existing XWPFTable to the arrays bodyElements and tables * diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java index 6ce7e2ac3d..778f020f29 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java @@ -84,7 +84,12 @@ public class XWPFSettings extends POIXMLDocumentPart { zoom = ctSettings.getZoom(); } - return zoom.getPercent().longValue(); + + BigInteger percent = zoom.getPercent(); + if(percent == null) { + return 100; + } + return percent.longValue(); } /** |