Skip to content

Instantly share code, notes, and snippets.

@bennettscience
Created August 13, 2015 16:07
Show Gist options
  • Save bennettscience/cd51762de17c860d6930 to your computer and use it in GitHub Desktop.
Save bennettscience/cd51762de17c860d6930 to your computer and use it in GitHub Desktop.
Getting Inline Drawings from Google Docs
// Don't forget your global variables up top.
// Search through the page elements. Paragraphs are top-level, which is why I start with those.
if( type == DocumentApp.ElementType.PARAGRAPH ){
// Look for child elements within the paragraph. Inline Drawings are children.
if(element.asParagraph().getNumChildren() !=0 && element.asParagraph().getChild(0).getType() == DocumentApp.ElementType.INLINE_DRAWING) {
// For whatever reason, drawings don't have their own methods in the InlineDrawing class. This bit copies and adds it to the bottom of the doc.
var drawing = element.asParagraph().copy();
body.appendParagraph(drawing);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment