I've been thinking over the last few days that when I was raving about OOW's implementation of fields, I had neglected to test a couple of things which I actually use extensively in my documents, and honestly, I was preparing myself to have to write my first "word does this better" post. I was wrong again. But I'm getting ahead of myself!
What I hadn't tested: using a single date field (call it 'Release Date') multiple times in a document, with several different formats.
So for example, using July 25th 2009 as the date in question, the following formats are required:
Front page: July 2009
Headers: 25/07/09
Creation date: -Jul-09 (I will be manually entering the day number as I create the doco)
QA Date & final revision date: same as creation date, but of course, I'll still be entering the day number manually.
In MSW, I have to go to Insert Field | Document Information | DocProperties, select the "ReleaseDate" field (which I defined earlier from another menu), then click the Field Codes button and remember the highly obscure string to append after the field - "\@ "MMMM yyyy".
Sometimes, if I haven't done this for while, I have to search through Help to try and remember what on earth the correct string is - I simply cannot seem to find a way to do this by selecting GUI options, it does seem you really do have to remember 'backslash at-sign' and then the appropriate format. Again - why was I so forgiving of Word for putting me through this torment???
Anyways, using multiple formats in OOW is a cinch. Lets assume you've already defined your field, but haven't inserted it yet.
Front Page "July 2009"
- Click at the place you need the date field, hit Ctrl+F2, make sure you have the Variables Tab selected
- Select User Field in the left column, your 'Release Date' field in the middle Selection Column, then
- In the right column, click on Additional Formats....
- Select Category of Date, and then scroll through the list of formats
- if your desired format isn't there, select something close and then modify the format field down the bottom - in this case "MMMM yyyy"
- Hit ok, hit insert. Close the dialog box and proceed to your document history section in the document, ready to use the field again.
Document history "-Jul-09"
So, you're at the insertion point
- repeat as above up to 4
- this time, you pretty much will have to do a custom format, so in the Format Field type "-MMM-yy" (again, you can pick something similar and then just modify the code - it will create you a custom format automatically)
- and again, hit ok, hit insert, close the dialog, and continue inserting the date field in as many formats as you require.
But wait! I want to use this document as the basis for the new report in August!
No problem.
Changing the date
- Double click any* one of the dates you've inserted, where the format includes all 3 of day, month & year.
- You'll probably notice that the value is now just a number and seriously doesn't look like a date. Don't worry. Just type in the date you want it to be, lets say 21 August 2009, or, 21/08/09, type either in and click the tick.
- Close the dialog box.
Hey Presto! ALL of your Release Date instances have been updated to the new date, and the correct format preserved for each one.
Extra for Experts (and geeks)* that little star unfortunately means that while testing this, I did come across a somewhat unexpected behaviour. To avoid encountering it, just follow the instructions I've given and make sure you select one of the date entries that includes the day, month and year before updating the date.
What I found:When I double clicked on the instances that didn't have the day, but just the month and year and tried to update the date, OOW got seriously confused, changed all the instances to whatever format I inputted and then I had to go back to another of the fields (with all 3 parameters) and update it, but it still wouldn't change to the new date, so I closed the dialog, and then double clicked the same one again and this time it would update them all. So no harm done (alll of the instances still have all the correct formatting), but if you tell OOW that 'december 2009' now needs to be '21 January 2009' it doesn't know what to do with that 21. So, yeah, programatically that makes sense, but from a usability perspective, it means I needed to be more specific in my instructions.