Return

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

https://www.googleapis.com/auth/documents.currentonly

https://www.googleapis.com/auth/documents

getChild(childIndex)

Retrieves the child element at the specified child index.

// Get the body section of the active document.
var body = DocumentApp.getActiveDocument().getBody();
// Obtain the first element in the document.
var firstChild = body.getChild(0);
// If it's a paragraph, set its contents.
if (firstChild.getType() == DocumentApp.ElementType.PARAGRAPH) {
firstChild.asParagraph().setText("This is the first paragraph.");
}

getListItems()

Return

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

https://www.googleapis.com/auth/documents.currentonly

https://www.googleapis.com/auth/documents

getMarginBottom()

Retrieves the bottom margin, in points.

Return

Number — the bottom margin, in points

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

https://www.googleapis.com/auth/documents.currentonly

https://www.googleapis.com/auth/documents

getMarginLeft()

Retrieves the left margin, in points.

Return

Number — the left margin, in points

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

https://www.googleapis.com/auth/documents.currentonly

https://www.googleapis.com/auth/documents

getMarginRight()

Retrieves the right margin.

Return

Number — the right margin, in points

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

https://www.googleapis.com/auth/documents.currentonly

https://www.googleapis.com/auth/documents

getMarginTop()

Retrieves the top margin.

Return

Number — the top margin, in points

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

https://www.googleapis.com/auth/documents.currentonly

https://www.googleapis.com/auth/documents

getNumChildren()

Retrieves the number of children.

// Get the body section of the active document.
var body = DocumentApp.getActiveDocument().getBody();
// Log the number of elements in the document.
Logger.log("There are " + body.getNumChildren() +
" elements in the document body.");

Return

Integer — the number of children

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

https://www.googleapis.com/auth/documents.currentonly

https://www.googleapis.com/auth/documents

getPageHeight()

Retrieves the page height, in points.

Return

Number — the page height, in points

Authorization

Scripts that use this method require authorization with one or more of the following scopes:

https://www.googleapis.com/auth/documents.currentonly

https://www.googleapis.com/auth/documents

getPageWidth()

Retrieves the page width, in points.

Return

Number — the page width, in points

Authorization

Scripts that use this method require authorization with one or more of the following scopes: