Google Apps Script API
    Preparing search index...

    An element representing a list item. A ListItem is a Paragraph that is associated with a list ID. A ListItem may contain Equation, Footnote, HorizontalRule, InlineDrawing, InlineImage, PageBreak, and Text elements. For more information on document structure, see the guide to extending Google Docs.

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

    ListItems with the same list ID belong to the same list and are numbered accordingly. The ListItems for a given list are not required to be adjacent in the document or even have the same parent element. Two items belonging to the same list may exist anywhere in the document while maintaining consecutive numbering, as the following example illustrates:

    var body = DocumentApp.getActiveDocument().getBody();
    
    // Append a new list item to the body.
    var item1 = body.appendListItem('Item 1');
    
    // Log the new list item's list ID.
    Logger.log(item1.getListId());
    
    // Append a table after the list item.
    body.appendTable([
      ['Cell 1', 'Cell 2']
    ]);
    
    // Append a second list item with the same list ID. The two items are treated as the same list,
    // despite not being consecutive.
    var item2 = body.appendListItem('Item 2');
    item2.setListId(item1);
    
    interface ListItem {
        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.ListItem;
        copy(): GoogleAppsScript.Document.ListItem;
        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;
        getGlyphType(): GlyphType;
        getHeading(): ParagraphHeading;
        getIndentEnd(): number;
        getIndentFirstLine(): number;
        getIndentStart(): number;
        getLineSpacing(): number;
        getLinkUrl(): string;
        getListId(): string;
        getNestingLevel(): number;
        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.ListItem;
        removeChild(
            child: GoogleAppsScript.Document.Element,
        ): GoogleAppsScript.Document.ListItem;
        removeFromParent(): GoogleAppsScript.Document.ListItem;
        removePositionedImage(id: string): boolean;
        replaceText(
            searchPattern: string,
            replacement: string,
        ): GoogleAppsScript.Document.Element;
        setAlignment(
            alignment: GoogleAppsScript.Document.HorizontalAlignment,
        ): GoogleAppsScript.Document.ListItem;
        setAttributes(attributes: any): GoogleAppsScript.Document.ListItem;
        setGlyphType(glyphType: GlyphType): GoogleAppsScript.Document.ListItem;
        setHeading(heading: ParagraphHeading): GoogleAppsScript.Document.ListItem;
        setIndentEnd(indentEnd: number): GoogleAppsScript.Document.ListItem;
        setIndentFirstLine(
            indentFirstLine: number,
        ): GoogleAppsScript.Document.ListItem;
        setIndentStart(indentStart: number): GoogleAppsScript.Document.ListItem;
        setLeftToRight(leftToRight: boolean): GoogleAppsScript.Document.ListItem;
        setLineSpacing(multiplier: number): GoogleAppsScript.Document.ListItem;
        setLinkUrl(url: string): GoogleAppsScript.Document.ListItem;
        setListId(
            listItem: GoogleAppsScript.Document.ListItem,
        ): GoogleAppsScript.Document.ListItem;
        setNestingLevel(nestingLevel: number): GoogleAppsScript.Document.ListItem;
        setSpacingAfter(spacingAfter: number): GoogleAppsScript.Document.ListItem;
        setSpacingBefore(spacingBefore: number): GoogleAppsScript.Document.ListItem;
        setText(text: string): void;
        setTextAlignment(
            textAlignment: TextAlignment,
        ): GoogleAppsScript.Document.ListItem;
    }

    Hierarchy (View Summary)

    Index

    Methods