Skip to content

Commit

Permalink
Enforce updating of fields when opening a word document
Browse files Browse the repository at this point in the history
This commit sets `XWPFDocument#enforceUpdateFields` to true so
that users are asked whether they want to update the references
in the document on first opening it.
  • Loading branch information
AntonOellerer committed Jun 5, 2024
1 parent c59b99c commit 62e4b46
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ protected Path generate() throws IOException {
logger.debug("Retrieved all body elements, starting WordGenerator");
WordGenerator.apply(resolver, bodyElements, options);

document.enforceUpdateFields();

try (OutputStream os = Files.newOutputStream(file)) {
logger.info("Writing document to {}", os);
document.write(os);
Expand Down

0 comments on commit 62e4b46

Please sign in to comment.