Created
August 13, 2015 16:07
-
-
Save bennettscience/cd51762de17c860d6930 to your computer and use it in GitHub Desktop.
Getting Inline Drawings from Google Docs
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
// 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