Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to change a date in a field within my word document, and have it update a couple other fields automatically within the same document. The behavior I'm seeking is basically the same as what a spreadsheet can do.

Is this possible?

More specifically, if the first page of the document has the date Jan 20 2012, I want to be able to change it, and then watch a couple other dates elsewhere automatically change to either the same date or the same date plus six days.

I would also "settle" for having all three fields updated from a central document property (though I don't know how to create one of those properties). Regardless of which approach is used, I want one of the dates to be <value> plus six days such as Jan 26 2012 based on the earlier example I gave.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

I believe this should work:

  1. Add the date to the first page of the document as usual.
  2. Wrap the field or text of the date with a bookmark, let's call it DateBookmark.
  3. In other places in the document where you want to include the date add a bookmark field to refer to the DateBookmark created before.
  4. Now whenever the date changes and field update is executed all dates will be synchronized.

For the calculated date you can look at the technique on this page here: http://addbalance.com/word/datefields2.htm

share|improve this answer
add comment

You will need to provide a custom XML file to store the data. You will need to use the new controls available in Word 2007/2010 and map them to the data stored in the XML file.

Here is a website that has some really good information. http://dbe.codeplex.com/

Word Content Control Toolkit This toolkit makes binding content controls to XML data in your Word document as easy as a drag and drop.

Details This is a stand-alone, light-weight tool that opens any Word Open XML document (eg .docx) and lists all of the content controls inside of it. The XML parts are also displayed, and a mapping between the content controls and the XML nodes can be accomplished by simply selecting the node and dropping it on the content control you wish to map to. The editor allows you to also edit/add/remove Custom XML parts and manipulate content control properties. The tool does not require Word to be installed because it operates directly on the new Open XML file formats by reading and writing to them using the System.IO.Packaging library available in .NET. The code to do this is included in the releases and can be used as a handy resource on how to perform complex manipulations of the format.

Learning More If you want to learn more about this tool as well as Open XML development, watch this Channel9 interview with the author: Matthew Scott: Application Development using the Open XML File Formats Tutorials Andrew Coates has posted a great tutorial using the Content Control Toolkit to bind a document to XML from scratch. View this tutorial here Writing macro code to validate your content controls? Download this tutorial to learn how to use the lesser known, yet powerful schema validation feature of content controls that comes with it's very own UI! The toolkit in action

--Matt Scott

Last edited Dec 20 2010 at 3:16 AM by mrscott, version 41

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.