Created
May 23, 2018 17:57
-
-
Save t3knoid/6a0b0cad167b43bafe47dc11757c382e to your computer and use it in GitHub Desktop.
Adding version information automatically in Microsoft Word document
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following will provide an automatic way of adding version information into a Microsoft Word document using an external text file. This is an ideal way in versioning documents using external controls such as a build script. The script can update external version file and then create a PDF of the document. Thereby, creating a "build" of the Word document. | |
1. Add a version.txt file in the same folder as your document. This file will contain a single line with the version information (e.g. 1.0.0) | |
2. Open the Word document and Add an IncludeText Quick Part. | |
3. Reveal the field codes by typing ALT-F9 | |
4. Position the cursor after "{ INCLUDETEXT" just before the closing " }" tag. | |
5. Go to Quick Part and insert a FileName field and tick the "Add path to filename" checkbox. | |
You should have the following code at this point. | |
{ INCLUDETEXT { FILENAME \P \* MERGEFORMAT } } | |
Finally modify the code manually by adding enclosing double quotes and the version.txt file relative to the filename: | |
{ INCLUDETEXT "{ FILENAME \P \* MERGEFORMAT }\\..\\version.txt" } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment