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

    Interface INamedStyleCollection

    The named cell styles of a workbook — the built-ins (Normal, Heading 1, Good, ...) and the ones the document defines.

    Office Scripts calls these predefined cell styles (Workbook.getPredefinedCellStyles()).

    Order is the gallery's: the built-ins in their definition order, each replaced in place by a custom style of the same name, then the document's own styles by name. A hidden style is left out unless asked for — see INamedStyleCollection.GetItemsOptions.includeHidden.

    Reached from IStyleCollection.getNamedStyles.

    interface INamedStyleCollection {
        isICollection: true;
        isINamedStyleCollection: true;
        "[iterator]"(): IterableIterator<IStyle.INamed>;
        addListeners(
            listeners: ICollection.IListeners,
            options?: IListener.Options,
        ): Remove;
        at(index: number): IStyle.INamed | undefined;
        every(
            predicate: (
                value: IStyle.INamed,
                index: number,
                items: readonly IStyle.INamed[],
            ) => boolean,
        ): boolean;
        filter<S extends IStyle.INamed>(
            predicate: (
                value: IStyle.INamed,
                index: number,
                items: readonly IStyle.INamed[],
            ) => value is S,
        ): S[];
        filter(
            predicate: (
                value: IStyle.INamed,
                index: number,
                items: readonly IStyle.INamed[],
            ) => boolean,
        ): IStyle.INamed[];
        find<S extends IStyle.INamed>(
            predicate: (
                value: IStyle.INamed,
                index: number,
                items: readonly IStyle.INamed[],
            ) => value is S,
        ): S | undefined;
        find(
            predicate: (
                value: IStyle.INamed,
                index: number,
                items: readonly IStyle.INamed[],
            ) => boolean,
        ): IStyle.INamed | undefined;
        findIndex(
            predicate: (
                value: IStyle.INamed,
                index: number,
                items: readonly IStyle.INamed[],
            ) => boolean,
        ): number;
        forEach(
            fn: (
                value: IStyle.INamed,
                index: number,
                items: readonly IStyle.INamed[],
            ) => void,
        ): void;
        getByName(name: string): IStyle.INamed | null;
        getCount(): number;
        getItems(options?: INamedStyleCollection.GetItemsOptions): IStyle.INamed[];
        indexOf(item: IStyle.INamed): number;
        isClosed(): boolean;
        map<U>(
            fn: (
                value: IStyle.INamed,
                index: number,
                items: readonly IStyle.INamed[],
            ) => U,
        ): U[];
        set(update: NamedUpdate, mergeIfExists?: boolean): IStyle.INamed;
        some(
            predicate: (
                value: IStyle.INamed,
                index: number,
                items: readonly IStyle.INamed[],
            ) => boolean,
        ): boolean;
        toArray(): IStyle.INamed[];
    }

    Hierarchy (View Summary)

    Implemented by

    Index
    isICollection: true

    For runtime type checking.

    isINamedStyleCollection: true

    For runtime type checking.

    • Iterates the collection's items.

      Returns IterableIterator<IStyle.INamed>

      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 IStyle.INamed | undefined

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

      Parameters

      • predicate: (
            value: IStyle.INamed,
            index: number,
            items: readonly IStyle.INamed[],
        ) => 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: IStyle.INamed,
            index: number,
            items: readonly IStyle.INamed[],
        ) => value is S

        Called once per item.

      Returns S[]

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

      Parameters

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

        Called once per item.

      Returns IStyle.INamed[]

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

      Type Parameters

      Parameters

      • predicate: (
            value: IStyle.INamed,
            index: number,
            items: readonly IStyle.INamed[],
        ) => 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: IStyle.INamed,
            index: number,
            items: readonly IStyle.INamed[],
        ) => boolean

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

      Returns IStyle.INamed | undefined

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

      Parameters

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

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

      Returns number

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

      Parameters

      Returns void

    • Returns the style with the given name, or null if there is none.

      Parameters

      • name: string

        The name, compared case-insensitively.

      Returns IStyle.INamed | null

      A custom style of a built-in's name replaces the built-in, and is what is returned.

    • 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

      Returns U[]

    • Adds or updates a style.

      Parameters

      • update: NamedUpdate

        The name, the style, and any of the other IStyle.NamedProperties.

      • OptionalmergeIfExists: boolean

        If true the style is merged over the existing one of that name; otherwise it replaces it.

      Returns IStyle.INamed

      The style as stored.

      false

      Names are case-insensitive. Setting a built-in's name customizes the built-in.

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

      Parameters

      • predicate: (
            value: IStyle.INamed,
            index: number,
            items: readonly IStyle.INamed[],
        ) => 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 IStyle.INamed[]

      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.