Google Apps Script API
    Preparing search index...

    An element representing a paragraph. A Paragraph may contain Equation, Footnote, HorizontalRule, InlineDrawing, InlineImage, PageBreak, and Text elements. For more information on document structure, see the guide to extending Google Docs.

    Paragraphs may not contain new-line characters. New-line characters ("\n") are converted to line-break characters ("\r").

    var body = DocumentApp.getActiveDocument().getBody();
    
    // Append a document header paragraph.
    var header = body.appendParagraph("A Document");
    header.setHeading(DocumentApp.ParagraphHeading.HEADING1);
    
    // Append a section header paragraph.
    var section = body.appendParagraph("Section 1");
    section.setHeading(DocumentApp.ParagraphHeading.HEADING2);
    
    // Append a regular paragraph.
    body.appendParagraph("This is a typical paragraph.");
    
    interface Paragraph {
        addPositionedImage(image: BlobSource): PositionedImage;
        appendHorizontalRule(): GoogleAppsScript.Document.HorizontalRule;
        appendInlineImage(image: BlobSource): InlineImage;
        appendInlineImage(image: InlineImage): InlineImage;
        appendPageBreak(
            pageBreak?: GoogleAppsScript.Document.PageBreak,
        ): GoogleAppsScript.Document.PageBreak;
        appendText(text: string): GoogleAppsScript.Document.Text;
        appendText(
            text: GoogleAppsScript.Document.Text,
        ): GoogleAppsScript.Document.Text;
        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.Paragraph;
        copy(): GoogleAppsScript.Document.Paragraph;
        editAsText(): GoogleAppsScript.Document.Text;
        findElement(elementType: ElementType, from?: RangeElement): RangeElement;
        findText(searchPattern: string, from?: RangeElement): RangeElement;
        getAlignment(): GoogleAppsScript.Document.HorizontalAlignment;
        getAttributes(): any;
        getChild(childIndex: number): GoogleAppsScript.Document.Element;
        getChildIndex(child: GoogleAppsScript.Document.Element): number;
        getHeading(): ParagraphHeading;
        getIndentEnd(): number;
        getIndentFirstLine(): number;
        getIndentStart(): number;
        getLineSpacing(): number;
        getLinkUrl(): string;
        getNextSibling(): GoogleAppsScript.Document.Element;
        getNumChildren(): number;
        getParent(): ContainerElement;
        getPositionedImage(id: string): PositionedImage;
        getPositionedImages(): PositionedImage[];
        getPreviousSibling(): GoogleAppsScript.Document.Element;
        getSpacingAfter(): number;
        getSpacingBefore(): number;
        getText(): string;
        getTextAlignment(): TextAlignment;
        getType(): ElementType;
        insertHorizontalRule(
            childIndex: number,
        ): GoogleAppsScript.Document.HorizontalRule;
        insertInlineImage(childIndex: number, image: BlobSource): InlineImage;
        insertInlineImage(childIndex: number, image: InlineImage): InlineImage;
        insertPageBreak(
            childIndex: number,
            pageBreak?: GoogleAppsScript.Document.PageBreak,
        ): GoogleAppsScript.Document.PageBreak;
        insertText(
            childIndex: number,
            text: string,
        ): GoogleAppsScript.Document.Text;
        insertText(
            childIndex: number,
            text: GoogleAppsScript.Document.Text,
        ): GoogleAppsScript.Document.Text;
        isAtDocumentEnd(): boolean;
        isLeftToRight(): boolean;
        merge(): GoogleAppsScript.Document.Paragraph;
        removeChild(
            child: GoogleAppsScript.Document.Element,
        ): GoogleAppsScript.Document.Paragraph;
        removeFromParent(): GoogleAppsScript.Document.Paragraph;
        removePositionedImage(id: string): boolean;
        replaceText(
            searchPattern: string,
            replacement: string,
        ): GoogleAppsScript.Document.Element;
        setAlignment(
            alignment: GoogleAppsScript.Document.HorizontalAlignment,
        ): GoogleAppsScript.Document.Paragraph;
        setAttributes(attributes: any): GoogleAppsScript.Document.Paragraph;
        setHeading(heading: ParagraphHeading): GoogleAppsScript.Document.Paragraph;
        setIndentEnd(indentEnd: number): GoogleAppsScript.Document.Paragraph;
        setIndentFirstLine(
            indentFirstLine: number,
        ): GoogleAppsScript.Document.Paragraph;
        setIndentStart(indentStart: number): GoogleAppsScript.Document.Paragraph;
        setLeftToRight(leftToRight: boolean): GoogleAppsScript.Document.Paragraph;
        setLineSpacing(multiplier: number): GoogleAppsScript.Document.Paragraph;
        setLinkUrl(url: string): GoogleAppsScript.Document.Paragraph;
        setSpacingAfter(spacingAfter: number): GoogleAppsScript.Document.Paragraph;
        setSpacingBefore(
            spacingBefore: number,
        ): GoogleAppsScript.Document.Paragraph;
        setText(text: string): void;
        setTextAlignment(
            textAlignment: TextAlignment,
        ): GoogleAppsScript.Document.Paragraph;
    }

    Hierarchy (View Summary)

    Index

    Methods