Skip to content

Instantly share code, notes, and snippets.

@simondahla
Created May 28, 2017 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simondahla/ebac5227a0e5362917079b3363a3878c to your computer and use it in GitHub Desktop.
Save simondahla/ebac5227a0e5362917079b3363a3878c to your computer and use it in GitHub Desktop.
function onEdit() {
var doc, footer, style = {};
// Define a custom paragraph style.
style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] = DocumentApp.HorizontalAlignment.RIGHT;
style[DocumentApp.Attribute.FONT_FAMILY] = 'Proxima Nova';
style[DocumentApp.Attribute.FONT_SIZE] = 6;
style[DocumentApp.Attribute.BOLD] = false;
style[DocumentApp.Attribute.ITALIC] = true;
doc = DocumentApp.getActiveDocument();
footer = doc.getFooter();
var d = new Date();
var utc = new Date(d.getTime() + d.getTimezoneOffset() * 60000);
if (!footer) {
doc.addFooter();
}
footer.removeChild(footer.getChild(0));
footer = footer.insertParagraph(0, 'Revised ' + utc);
footer.setAttributes(style).setForegroundColor('#999999');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment