SheetXL - v1.0.2
    Preparing search index...

    Interface ISlicerStyleCollection

    The slicer styles of a workbook — the built-ins (SlicerStyleLight1, ...) and the ones the document defines — and which of them is the default for a new slicer.

    Office Scripts has the same shape: Workbook.getSlicerStyles(), getSlicerStyle(name), getDefaultSlicerStyle() / setDefaultSlicerStyle(style).

    Order is the gallery's: the built-ins (Light, Other, Dark), each replaced in place by a custom style of the same name, then the document's own styles by name.

    onCollectionChange announces a style added, changed or deleted, and a change of the default.

    Reached from IStyleCollection.getSlicerStyles.

    interface ISlicerStyleCollection {
        isICollection: true;
        isISlicerStyleCollection: true;
        length: number;
        "[iterator]"(): IterableIterator<ISlicerStyle>;
        addListeners(
            listeners: ICollection.IListeners,
            options?: IListener.Options,
        ): Remove;
        at(index: number): ISlicerStyle | undefined;
        every(
            predicate: (
                value: ISlicerStyle,
                index: number,
                items: readonly ISlicerStyle[],
            ) => boolean,
        ): boolean;
        filter<S extends ISlicerStyle>(
            predicate: (
                value: ISlicerStyle,
                index: number,
                items: readonly ISlicerStyle[],
            ) => value is S,
        ): S[];
        filter(
            predicate: (
                value: ISlicerStyle,
                index: number,
                items: readonly ISlicerStyle[],
            ) => boolean,
        ): ISlicerStyle[];
        find<S extends ISlicerStyle>(
            predicate: (
                value: ISlicerStyle,
                index: number,
                items: readonly ISlicerStyle[],
            ) => value is S,
        ): S | undefined;
        find(
            predicate: (
                value: ISlicerStyle,
                index: number,
                items: readonly ISlicerStyle[],
            ) => boolean,
        ): ISlicerStyle | undefined;
        findIndex(
            predicate: (
                value: ISlicerStyle,
                index: number,
                items: readonly ISlicerStyle[],
            ) => boolean,
        ): number;
        forEach(
            fn: (
                value: ISlicerStyle,
                index: number,
                items: readonly ISlicerStyle[],
            ) => void,
        ): void;
        getByName(name: string): ISlicerStyle | null;
        getCount(): number;
        getDefault(): ISlicerStyle;
        getItems(options?: ISlicerStyleCollection.GetItemsOptions): ISlicerStyle[];
        indexOf(item: ISlicerStyle): number;
        isClosed(): boolean;
        map<U>(
            fn: (
                value: ISlicerStyle,
                index: number,
                items: readonly ISlicerStyle[],
            ) => U,
        ): U[];
        set(
            name: string,
            properties: Omit<ISlicerStyle.ResolvableProperties, "name">,
        ): ISlicerStyle;
        setDefault(style: string | ISlicerStyle): ISlicerStyle;
        some(
            predicate: (
                value: ISlicerStyle,
                index: number,
                items: readonly ISlicerStyle[],
            ) => boolean,
        ): boolean;
        toArray(): ISlicerStyle[];
        readonly [index: number]: ISlicerStyle;
    }

    Hierarchy (View Summary)

    Implemented by

    Indexable

    • readonly [index: number]: ISlicerStyle

      The item at the given index, or undefined if there is none — wb.getWorksheets()[0].

      Read-only and live: each read is against the collection as it is now. Assigning through an index throws.

    Index
    isICollection: true

    For runtime type checking.

    isISlicerStyleCollection: true

    For runtime type checking.

    length: number

    The number of items — the same as getCount.

    • Iterates the collection's items.

      Returns IterableIterator<ISlicerStyle>

      The unfiltered walk — for (const sheet of wb.getWorksheets()). 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 ISlicerStyle | undefined

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

      Parameters

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

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

      Returns boolean

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

      Type Parameters

      Parameters

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

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

      Returns ISlicerStyle | undefined

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

      Parameters

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

    • Sets the style a slicer is given when it is created without one.

      Parameters

      • style: string | ISlicerStyle

        The style, or its name. A name that matches nothing sets the default back to SlicerStyleLight1, the built-in default.

      Returns ISlicerStyle

      The previous default.

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

      Parameters

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

      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.