settings.setZoomPercent(zoomPercent);
}
+ /**
+ * Returns the even-and-odd-headings setting
+ *
+ * @return True or false indicating whether or not separate even and odd headings is turned on.
+ */
+ public boolean getEvenAndOddHeadings() {
+ return settings.getEvenAndOddHeadings();
+ }
+
+ /**
+ * Sets the even-and-odd-headings setting
+ * @param enable Set to true to turn on separate even and odd headings.
+ */
+ public void setEvenAndOddHeadings(boolean enable) {
+ settings.setEvenAndOddHeadings(enable);
+ }
+
+ /**
+ * Returns the mirror margins setting
+ *
+ * @return True or false indicating whether or not mirror margins is turned on.
+ */
+ public boolean getMirrorMargins() {
+ return settings.getMirrorMargins();
+ }
+
+ /**
+ * Sets the mirror margins setting
+ * @param enable Set to true to turn on mirror margins.
+ */
+ public void setMirrorMargins(boolean enable) {
+ settings.setMirrorMargins(enable);
+ }
+
/**
* inserts an existing XWPFTable to the arrays bodyElements and tables
*
return false;
}
}
+
}
throw new RuntimeException(e);
}
}
+
+ /**
+ * Check if separate even and odd headings is turned on.
+ *
+ * @return True if even and odd headings is turned on.
+ */
+ public boolean getEvenAndOddHeadings() {
+ return ctSettings.isSetEvenAndOddHeaders();
+ }
+
+ /**
+ * Turn separate even-and-odd headings on or off
+ *
+ * @param enable <code>true</code> to turn on separate even and odd headings,
+ * <code>false</code> to turn off even and odd headings.
+ */
+ public void setEvenAndOddHeadings(boolean enable) {
+ CTOnOff onOff = CTOnOff.Factory.newInstance();
+ onOff.setVal(enable ? STOnOff.TRUE : STOnOff.FALSE);
+ ctSettings.setEvenAndOddHeaders(onOff);
+ }
+
+ /**
+ * Check if mirrored margins is turned on
+ *
+ * @return True if mirrored margins is turned on.
+ */
+ public boolean getMirrorMargins() {
+ return ctSettings.isSetMirrorMargins();
+ }
+
+ /**
+ * Turn mirrored margins on or off
+ *
+ * @param enable <code>true</code> to turn on mirrored margins,
+ * <code>false</code> to turn off mirrored marginss.
+ */
+ public void setMirrorMargins(boolean enable) {
+ CTOnOff onOff = CTOnOff.Factory.newInstance();
+ onOff.setVal(enable ? STOnOff.TRUE : STOnOff.FALSE);
+ ctSettings.setMirrorMargins(onOff);
+ }
+
+
}
assertEquals(100, settings.getZoomPercent());
settings.setZoomPercent(50);
assertEquals(50, settings.getZoomPercent());
+
+ assertEquals(false, settings.getEvenAndOddHeadings());
+ settings.setEvenAndOddHeadings(true);
+ assertEquals(true, settings.getEvenAndOddHeadings());
+
+ assertEquals(false, settings.getMirrorMargins());
+ settings.setMirrorMargins(true);
+ assertEquals(true, settings.getMirrorMargins());
XWPFDocument doc = new XWPFDocument();
assertEquals(100, doc.getZoomPercent());
doc.setZoomPercent(200);
assertEquals(200, doc.getZoomPercent());
+ assertEquals(false, doc.getEvenAndOddHeadings());
+ doc.setEvenAndOddHeadings(true);
+ assertEquals(true, doc.getEvenAndOddHeadings());
+
+ assertEquals(false, doc.getMirrorMargins());
+ doc.setMirrorMargins(true);
+ assertEquals(true, doc.getMirrorMargins());
+
XWPFDocument back = XWPFTestDataSamples.writeOutAndReadBack(doc);
assertEquals(200, back.getZoomPercent());
back.close();