Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

I've created a word processing document that will be used by many people (a style sheet for writers), and will also be updated periodically. I suspect that well have some who print the document out for reference. Is it possible in Google Documents to put field codes in the footer that indicate the print date or the save date? If not, maybe we could name the document "[document title] version [x]" and have that print in the footer?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

Alas, this doesn't seem possible right now; Google Docs doesn't support the auto-updating fields that Office does.

Here is a support thread where you can request this feature, though - I've also posted a reply on it.

share|improve this answer
    
Thanks; I added a comment as well. That thread did tell me how to add a page count (i.e., page X of Y), that would have been my next question! –  neilfein Sep 7 '10 at 21:33
add comment

Yes, it is possible. However, it is not something that is really possible utilizing the existing API. Really the lack of fields and the associated capabilities like in Word is a major disability for document automation.

Something like this will insert a footer on document open and reopen, but it is ultimately not a good solution.

function onOpen() {
    var time = new Date();
    time = Utilities.formatDate(time, "GMT", "yyyy-MM-dd'T'HH:mm:ss'Z'");
    var doc = DocumentApp.getActiveDocument();
    var s;

    if (!doc.getFooter()) {
        var footer = doc.addFooter();
        var footerText = footer.appendParagrap(time);
    } else {
        var footer = doc.getFooter();
        var footerElements = footer.getNumChildren();
        var para = footer.getParagraphs();
        s = para[footerElements-1].getText();
        var footerText = footer.replaceText(s , time);
    }
};

EDIT: How to add the script.

This code as I have presented above really should be in its own function called from the OnOpen() function rather than in there wholesale, but all good for example purposes.

If you go the Tools menu of an open document then down to Script Manager, when it loads check that it is currently empty, if has a records there, you are on your own for placement of the code.

Close the script manager, back to the Tools Menu and select Script Editor. Now if you had nothing in your script manager, select all the code and delete it. You can then paste in the code provided above and then save it.

Close the document and re-open and you should find there is now a Time Date in the footer. It should update on every open of the document, nothing fancy but will get you going.

Now for those of you who have code already associated with your document. Adding the code above minus the first and last lines into the onOpen() function will also work, but it may not due to code already present conflicting.

Hope this gets you going.

share|improve this answer
    
Perhaps you can tell the folks how to add the script? –  Jacob Jan Tuinstra Jul 22 '13 at 13:34
    
@JacobJanTuinstra I updated the response, I hope this helps. –  jCisco Jul 23 '13 at 0:39
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.