The FlagTOCToBeUpdated Command

by Peter on September 20, 2012

in User Reference

Note that with effect from Version 6.4.1 of XpressDox, the functionality of this command is exactly the same as for the UpdateFields command.

When a template contains a Word Table of Contents (TOC), that TOC can sometimes become invalid when conditional assembly in the template causes some of the constituents of that TOC to be removed or modified.  Normally this requires the Word user to request of Word that the TOC be updated.

Template authors often use a Word macro to perform the updating of the TOC.  But sometimes, particularly when the template is run in the cloud, the template author is not in control of the environment after the template has been merged and it is then opened in Word, and so cannot, with any confidence, cause a macro to be run when the merged document is opened.  In such a situation the command

«FlagTOCToBeUpdated(Yes)»

will cause Word to notice, when the merge document is first opened, that the TOC needs to be updated, and will ask the user whether this update should be performed automatically.

With effect from Version 5 of XpressDox, this command applies to all Word fields and not just the TOC. In particular, Date and Page Number fields can be updated using this mechanism.

Note that the wording of the message that Word presents in this situation is not very clear.  It says, “This document contains fields that may refer to other files.  Do you want to update the fields in this document?”.  While it is strictly correct that some fields may indeed refer to other files, the real issue in this instance is that the TOC may be invalid for some mundane reason like the page references have changed during assembly.  Unfortunately, XpressDox can’t control the wording of this message.