SheetXL - v0.8.0-beta.9+sites.210.e2d420901
    Preparing search index...

    Interface ICommentCollection

    Holds comments — a sheet's, or every sheet's in the workbook.

    interface ICommentCollection {
        isICollection: true;
        isICommentCollection: true;
        "[iterator]"(): IterableIterator<IComment>;
        add(
            address: ICellRange.Address,
            content: IComment.Content,
            options?: ICommentCollection.AddOptions,
        ): IComment;
        addListeners(
            listeners: ICollection.IListeners,
            options?: IListener.Options,
        ): Remove;
        at(index: number): IComment | undefined;
        every(
            predicate: (
                value: IComment,
                index: number,
                items: readonly IComment[],
            ) => boolean,
        ): boolean;
        filter<S extends IComment>(
            predicate: (
                value: IComment,
                index: number,
                items: readonly IComment[],
            ) => value is S,
        ): S[];
        filter(
            predicate: (
                value: IComment,
                index: number,
                items: readonly IComment[],
            ) => boolean,
        ): IComment[];
        find<S extends IComment>(
            predicate: (
                value: IComment,
                index: number,
                items: readonly IComment[],
            ) => value is S,
        ): S | undefined;
        find(
            predicate: (
                value: IComment,
                index: number,
                items: readonly IComment[],
            ) => boolean,
        ): IComment | undefined;
        findIndex(
            predicate: (
                value: IComment,
                index: number,
                items: readonly IComment[],
            ) => boolean,
        ): number;
        forEach(
            fn: (
                value: IComment,
                index: number,
                items: readonly IComment[],
            ) => void,
        ): void;
        getAt(address: ICellRange.Address): IComment | null;
        getById(id: string): IComment | null;
        getByReplyId(replyId: string): IComment | null;
        getCount(): number;
        getItems(options?: ICommentCollection.GetItemsOptions): IComment[];
        indexOf(item: IComment): number;
        isClosed(): boolean;
        map<U>(
            fn: (value: IComment, index: number, items: readonly IComment[]) => U,
        ): U[];
        some(
            predicate: (
                value: IComment,
                index: number,
                items: readonly IComment[],
            ) => boolean,
        ): boolean;
        toArray(): IComment[];
    }

    Hierarchy (View Summary)

    Index
    isICollection: true

    For runtime type checking.

    isICommentCollection: true

    For runtime type checking.

    • Iterates the collection's items.

      Returns IterableIterator<IComment>

      The unfiltered walk — for (const sheet of wb.getSheets()). Every other iterable surface in the SDK (ICellRange, ICellRegions, ICellRanges) reads this way, so a collection that did not was a trap: for…of over one is the obvious line to write and it threw at runtime with nothing in the types to warn first.

      getItems remains the call that takes options — filtering, ordering, anything parameterized. This is sugar over the unfiltered case, not a replacement for it.

    • Returns the item at the given index, or undefined if there is none.

      Parameters

      • index: number

        The position in iteration order. A negative index counts back from the end, as Array.prototype.at does.

      Returns IComment | undefined

    • Returns true if the predicate accepts every item, including when there are none.

      Parameters

      • predicate: (value: IComment, index: number, items: readonly IComment[]) => boolean

        Called once per item in iteration order until it returns false.

      Returns boolean

    • Returns the items the predicate accepts, in iteration order.

      Type Parameters

      Parameters

      • predicate: (value: IComment, index: number, items: readonly IComment[]) => value is S

        Called once per item.

      Returns S[]

    • Returns the items the predicate accepts, in iteration order.

      Parameters

      • predicate: (value: IComment, index: number, items: readonly IComment[]) => boolean

        Called once per item.

      Returns IComment[]

    • Returns the first item the predicate accepts, or undefined if it accepts none.

      Type Parameters

      Parameters

      • predicate: (value: IComment, index: number, items: readonly IComment[]) => value is S

        Called once per item in iteration order until it returns true.

      Returns S | undefined

    • Returns the first item the predicate accepts, or undefined if it accepts none.

      Parameters

      • predicate: (value: IComment, index: number, items: readonly IComment[]) => boolean

        Called once per item in iteration order until it returns true.

      Returns IComment | undefined

    • Returns the index of the first item the predicate accepts, or -1 if it accepts none.

      Parameters

      • predicate: (value: IComment, index: number, items: readonly IComment[]) => boolean

        Called once per item in iteration order until it returns true.

      Returns number

    • Calls the function once per item, in iteration order.

      Parameters

      • fn: (value: IComment, index: number, items: readonly IComment[]) => void

        Called once per item.

      Returns void

    • Returns the comment on the given cell, or null if there is none.

      Parameters

      • address: ICellRange.Address

        A cell. For a larger address, the first comment within it in reading order.

      Returns IComment | null

    • Returns the comment with the given id, or null if there is none.

      Parameters

      • id: string

      Returns IComment | null

    • Returns the comment a reply belongs to, or null if no thread has that reply.

      Parameters

      • replyId: string

      Returns IComment | null

    • Returns the total items available.

      Returns number

      returns the total number of items available.

    • Returns the index of the item in iteration order, or -1 if it is not in the collection.

      Parameters

      Returns number

    • Returns true once the collection has been closed.

      Returns boolean

      A closed collection is empty and announces nothing further. Collections that are closed by their owner (the workbook's names, functions and modules, when the workbook closes) announce it once with ICollection.Events.onClose; the others are never closed and always return false.

    • Returns the result of calling the function on every item, in iteration order.

      Type Parameters

      • U

      Parameters

      • fn: (value: IComment, index: number, items: readonly IComment[]) => U

        Called once per item.

      Returns U[]

    • Returns true if the predicate accepts at least one item.

      Parameters

      • predicate: (value: IComment, index: number, items: readonly IComment[]) => boolean

        Called once per item in iteration order until it returns true.

      Returns boolean

    • Returns the items as a fresh array, in iteration order.

      Returns IComment[]

      The call to make when an array is really wanted. The array is the caller's: changing it does not change the collection, and it does not follow later changes to the collection.