@Override protected void onDocumentRead() throws IOException { super.onDocumentRead(); readFrom(getPackagePart().getInputStream()); }
/** * Verifies that the documentProtection tag in settings.xml file <br> * specifies that the protection is enforced (w:enforcement="1") <br> * <br> * sample snippet from settings.xml * <pre> * <w:settings ... > * <w:documentProtection w:edit="readOnly" w:enforcement="1"/> * </pre> * * @return true if documentProtection is enforced with option any */ public boolean isEnforcedProtection() { return settings.isEnforcedWith(); }
public boolean isEnforcedUpdateFields() { return settings.isUpdateFields(); }
/** * Enforce the Filling Forms protection.<br> * In the documentProtection tag inside settings.xml file, <br> * it sets the value of enforcement to "1" (w:enforcement="1") <br> * and the value of edit to forms (w:edit="forms")<br> * <br> * sample snippet from settings.xml * <pre> * <w:settings ... > * <w:documentProtection w:edit="forms" w:enforcement="1"/> * </pre> */ public void enforceFillingFormsProtection() { settings.setEnforcementEditValue(STDocProtect.FORMS); }
@Override protected void commit() throws IOException { if (ctSettings == null) { throw new IllegalStateException("Unable to write out settings that were never read in!"); } XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTSettings.type.getName().getNamespaceURI(), "settings")); PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); ctSettings.save(out, xmlOptions); out.close(); }
/** * Removes protection enforcement.<br> * In the documentProtection tag inside settings.xml file <br> * it sets the value of enforcement to "0" (w:enforcement="0") <br> */ public void removeEnforcement() { safeGetDocumentProtection().setEnforcement(STOnOff.X_0); }
/** * Remove protection enforcement.<br> * In the documentProtection tag inside settings.xml file <br> * it sets the value of enforcement to "0" (w:enforcement="0") <br> */ public void removeProtectionEnforcement() { settings.removeEnforcement(); }
/** * Enforces fields update on document open (in Word). * In the settings.xml file <br> * sets the updateSettings value to true (w:updateSettings w:val="true") * <p> * NOTICES: * <ul> * <li>Causing Word to ask on open: "This document contains fields that may refer to other files. Do you want to update the fields in this document?" * (if "Update automatic links at open" is enabled)</li> * <li>Flag is removed after saving with changes in Word </li> * </ul> */ public void enforceUpdateFields() { settings.setUpdateFields(); }
settings.onDocumentRead(); } else if (relation.equals(XWPFRelation.IMAGES.getRelation())) { XWPFPictureData picData = (XWPFPictureData) p;
/** * 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(); }
/** * Enforce the Tracked Changes protection.<br> * In the documentProtection tag inside settings.xml file, <br> * it sets the value of enforcement to "1" (w:enforcement="1") <br> * and the value of edit to trackedChanges (w:edit="trackedChanges")<br> * <br> * sample snippet from settings.xml * <pre> * <w:settings ... > * <w:documentProtection w:edit="trackedChanges" w:enforcement="1"/> * </pre> */ public void enforceTrackedChangesProtection() { settings.setEnforcementEditValue(STDocProtect.TRACKED_CHANGES); }
@Override protected void commit() throws IOException { if (ctSettings == null) { throw new IllegalStateException("Unable to write out settings that were never read in!"); } XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS); xmlOptions.setSaveSyntheticDocumentElement(new QName(CTSettings.type.getName().getNamespaceURI(), "settings")); PackagePart part = getPackagePart(); OutputStream out = part.getOutputStream(); ctSettings.save(out, xmlOptions); out.close(); }
/** * Enforces the protection with the option specified by passed editValue.<br> * <br> * In the documentProtection tag inside settings.xml file <br> * it sets the value of enforcement to "1" (w:enforcement="1") <br> * and the value of edit to the passed editValue (w:edit="[passed editValue]")<br> * <br> * sample snippet from settings.xml * <pre> * <w:settings ... > * <w:documentProtection w:edit="[passed editValue]" w:enforcement="1"/> * </pre> */ public void setEnforcementEditValue(org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect.Enum editValue) { safeGetDocumentProtection().setEnforcement(STOnOff.X_1); safeGetDocumentProtection().setEdit(editValue); }
/** * Remove protection enforcement.<br/> * In the documentProtection tag inside settings.xml file <br/> * it sets the value of enforcement to "0" (w:enforcement="0") <br/> */ public void removeProtectionEnforcement() { settings.removeEnforcement(); }
/** * Enforces fields update on document open (in Word). * In the settings.xml file <br> * sets the updateSettings value to true (w:updateSettings w:val="true") * <p> * NOTICES: * <ul> * <li>Causing Word to ask on open: "This document contains fields that may refer to other files. Do you want to update the fields in this document?" * (if "Update automatic links at open" is enabled)</li> * <li>Flag is removed after saving with changes in Word </li> * </ul> */ public void enforceUpdateFields() { settings.setUpdateFields(); }
settings.onDocumentRead(); } else if (relation.equals(XWPFRelation.IMAGES.getRelation())) { XWPFPictureData picData = (XWPFPictureData) p;
/** * 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(); }
@Override protected void onDocumentRead() throws IOException { super.onDocumentRead(); readFrom(getPackagePart().getInputStream()); }
/** * Enforces the readOnly protection.<br> * In the documentProtection tag inside settings.xml file, <br> * it sets the value of enforcement to "1" (w:enforcement="1") <br> * and the value of edit to readOnly (w:edit="readOnly")<br> * <br> * sample snippet from settings.xml * <pre> * <w:settings ... > * <w:documentProtection w:edit="readOnly" w:enforcement="1"/> * </pre> */ public void enforceReadonlyProtection() { settings.setEnforcementEditValue(STDocProtect.READ_ONLY); }
/** * Verifies that the documentProtection tag in settings.xml file <br> * specifies that the protection is enforced (w:enforcement="1") <br> * and that the kind of protection is forms (w:edit="forms")<br> * <br> * sample snippet from settings.xml * <pre> * <w:settings ... > * <w:documentProtection w:edit="forms" w:enforcement="1"/> * </pre> * * @return true if documentProtection is enforced with option forms */ public boolean isEnforcedFillingFormsProtection() { return settings.isEnforcedWith(STDocProtect.FORMS); }