ASF Bugzilla – Attachment 27323 Details for
Bug 51564
[PATCH] added support for enforcing fields update
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Diff against SVN with added funcionality (setting updateFields value to true in settings.xml)
apache-poi-update-fields.patch (text/plain), 2.77 KB, created by
matej.krchniak
on 2011-07-27 12:47:45 UTC
(
hide
)
Description:
Diff against SVN with added funcionality (setting updateFields value to true in settings.xml)
Filename:
MIME Type:
Creator:
matej.krchniak
Created:
2011-07-27 12:47:45 UTC
Size:
2.77 KB
patch
obsolete
>Index: src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java >=================================================================== >--- src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java (revision 1151345) >+++ src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFSettings.java (working copy) >@@ -30,6 +30,7 @@ > import org.apache.poi.openxml4j.opc.PackageRelationship; > import org.apache.xmlbeans.XmlOptions; > import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTDocProtect; >+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTOnOff; > import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSettings; > import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTZoom; > import org.openxmlformats.schemas.wordprocessingml.x2006.main.STDocProtect; >@@ -147,6 +148,24 @@ > safeGetDocumentProtection().setEnforcement(STOnOff.X_0); > } > >+ /** >+ * 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") >+ * >+ * 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 setUpdateFields() { >+ CTOnOff onOff = CTOnOff.Factory.newInstance(); >+ onOff.setVal(STOnOff.TRUE); >+ ctSettings.setUpdateFields(onOff); >+ } >+ > @Override > protected void commit() throws IOException { > >Index: src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java >=================================================================== >--- src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java (revision 1151345) >+++ src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java (working copy) >@@ -1016,6 +1016,22 @@ > } > > /** >+ * 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") >+ * >+ * 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(); >+ } >+ >+ /** > * inserts an existing XWPFTable to the arrays bodyElements and tables > * @param pos > * @param table
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 51564
:
27322
| 27323