Created
May 28, 2017 20:26
-
-
Save simondahla/ebac5227a0e5362917079b3363a3878c to your computer and use it in GitHub Desktop.
This file contains 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
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