Backport gdocs improvements from dailygraphics. Closes #313.