Google Apps Script API
    Preparing search index...

    An element representing a document body. The Body may contain ListItem, Paragraph, Table, and TableOfContents elements. For more information on document structure, see the guide to extending Google Docs.

    The Body typically contains the full document contents except for the HeaderSection, FooterSection, and any FootnoteSection elements.

    var doc = DocumentApp.getActiveDocument();
    var body = doc.getBody();
    
    // Append a paragraph and a page break to the document body section directly.
    body.appendParagraph("A paragraph.");
    body.appendPageBreak();
    
    interface Body {
        appendHorizontalRule(): GoogleAppsScript.Document.HorizontalRule;
        appendImage(image: BlobSource): InlineImage;
        appendImage(image: InlineImage): InlineImage;
        appendListItem(
            listItem: GoogleAppsScript.Document.ListItem,
        ): GoogleAppsScript.Document.ListItem;
        appendListItem(text: string): GoogleAppsScript.Document.ListItem;
        appendPageBreak(): GoogleAppsScript.Document.PageBreak;
        appendPageBreak(
            pageBreak: GoogleAppsScript.Document.PageBreak,
        ): GoogleAppsScript.Document.PageBreak;
        appendParagraph(
            paragraph: GoogleAppsScript.Document.Paragraph,
        ): GoogleAppsScript.Document.Paragraph;
        appendParagraph(text: string): GoogleAppsScript.Document.Paragraph;
        appendTable(): GoogleAppsScript.Document.Table;
        appendTable(cells: string[][]): GoogleAppsScript.Document.Table;
        appendTable(
            table: GoogleAppsScript.Document.Table,
        ): GoogleAppsScript.Document.Table;
        asBody(): GoogleAppsScript.Document.Body;
        asDate(): GoogleAppsScript.Document.Date;
        asEquation(): GoogleAppsScript.Document.Equation;
        asEquationFunction(): EquationFunction;
        asEquationFunctionArgumentSeparator(): EquationFunctionArgumentSeparator;
        asEquationSymbol(): EquationSymbol;
        asFooterSection(): FooterSection;
        asFootnote(): GoogleAppsScript.Document.Footnote;
        asFootnoteSection(): FootnoteSection;
        asHeaderSection(): HeaderSection;
        asHorizontalRule(): GoogleAppsScript.Document.HorizontalRule;
        asInlineDrawing(): InlineDrawing;
        asInlineImage(): InlineImage;
        asListItem(): GoogleAppsScript.Document.ListItem;
        asPageBreak(): GoogleAppsScript.Document.PageBreak;
        asParagraph(): GoogleAppsScript.Document.Paragraph;
        asPerson(): GoogleAppsScript.Document.Person;
        asRichLink(): RichLink;
        asTable(): GoogleAppsScript.Document.Table;
        asTableCell(): GoogleAppsScript.Document.TableCell;
        asTableOfContents(): GoogleAppsScript.Document.TableOfContents;
        asTableRow(): GoogleAppsScript.Document.TableRow;
        asText(): GoogleAppsScript.Document.Text;
        clear(): GoogleAppsScript.Document.Body;
        copy(): GoogleAppsScript.Document.Body;
        editAsText(): GoogleAppsScript.Document.Text;
        findElement(elementType: ElementType, from?: RangeElement): RangeElement;
        findText(searchPattern: string, from?: RangeElement): RangeElement;
        getAttributes(): any;
        getChild(childIndex: number): GoogleAppsScript.Document.Element;
        getChildIndex(child: GoogleAppsScript.Document.Element): number;
        getFootnotes(): GoogleAppsScript.Document.Footnote[];
        getHeadingAttributes(paragraphHeading: ParagraphHeading): any;
        getImages(): InlineImage[];
        getLinkUrl(): string;
        getListItems(): GoogleAppsScript.Document.ListItem[];
        getMarginBottom(): number;
        getMarginLeft(): number;
        getMarginRight(): number;
        getMarginTop(): number;
        getNextSibling(): GoogleAppsScript.Document.Element;
        getNumChildren(): number;
        getPageHeight(): number;
        getPageWidth(): number;
        getParagraphs(): GoogleAppsScript.Document.Paragraph[];
        getParent(): ContainerElement;
        getPreviousSibling(): GoogleAppsScript.Document.Element;
        getTables(): GoogleAppsScript.Document.Table[];
        getText(): string;
        getTextAlignment(): TextAlignment;
        getType(): ElementType;
        insertHorizontalRule(
            childIndex: number,
        ): GoogleAppsScript.Document.HorizontalRule;
        insertImage(childIndex: number, image: BlobSource): InlineImage;
        insertImage(childIndex: number, image: InlineImage): InlineImage;
        insertListItem(
            childIndex: number,
            listItem: GoogleAppsScript.Document.ListItem,
        ): GoogleAppsScript.Document.ListItem;
        insertListItem(
            childIndex: number,
            text: string,
        ): GoogleAppsScript.Document.ListItem;
        insertPageBreak(
            childIndex: number,
            pageBreak?: GoogleAppsScript.Document.PageBreak,
        ): GoogleAppsScript.Document.PageBreak;
        insertParagraph(
            childIndex: number,
            paragraph: GoogleAppsScript.Document.Paragraph,
        ): GoogleAppsScript.Document.Paragraph;
        insertParagraph(
            childIndex: number,
            text: string,
        ): GoogleAppsScript.Document.Paragraph;
        insertTable(
            childIndex: number,
            cellsOrTable?: GoogleAppsScript.Document.Table | string[][],
        ): GoogleAppsScript.Document.Table;
        isAtDocumentEnd(): boolean;
        merge(): GoogleAppsScript.Document.Element;
        removeChild(
            child: GoogleAppsScript.Document.Element,
        ): GoogleAppsScript.Document.Body;
        removeFromParent(): GoogleAppsScript.Document.Element;
        replaceText(
            searchPattern: string,
            replacement: string,
        ): GoogleAppsScript.Document.Element;
        setAttributes(attributes: any): GoogleAppsScript.Document.Body;
        setHeadingAttributes(
            paragraphHeading: ParagraphHeading,
            attributes: any,
        ): GoogleAppsScript.Document.Body;
        setLinkUrl(url: string): GoogleAppsScript.Document.Body;
        setMarginBottom(marginBottom: number): GoogleAppsScript.Document.Body;
        setMarginLeft(marginLeft: number): GoogleAppsScript.Document.Body;
        setMarginRight(marginRight: number): GoogleAppsScript.Document.Body;
        setMarginTop(marginTop: number): GoogleAppsScript.Document.Body;
        setPageHeight(pageHeight: number): GoogleAppsScript.Document.Body;
        setPageWidth(pageWidth: number): GoogleAppsScript.Document.Body;
        setText(text: string): GoogleAppsScript.Document.Body;
        setTextAlignment(
            textAlignment: TextAlignment,
        ): GoogleAppsScript.Document.Body;
    }

    Hierarchy (View Summary)

    Index

    Methods