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

    Interface FormatSelection

    Everything the format panels need from the workbook, resolved from the live selection.

    The panels themselves stay presentational — they read style and call applyStyle. That keeps each one usable outside the task pane (a dialog, a shape inspector) by handing it a different implementation of this shape.

    interface FormatSelection {
        applyStyle: (
            update: Update | readonly Update[],
            description?: string,
            autoFit?: AutoFitOptions,
        ) => void;
        autoColor: IColor;
        cell: ICell;
        createBorder: (properties: Partial<IBorders.Properties>) => IBorders | null;
        createCell: (update: Update) => ICell | null;
        darkMode: boolean;
        disabled: boolean;
        getEdgeStroke: (edge: Edge) => IStroke | null;
        hasInnerHorizontal: boolean;
        hasInnerVertical: boolean;
        schemeLookup: SchemeLookup;
        sheet: ISheet;
        style: IStyle;
        styles: IStyleCollection;
    }
    Index
    applyStyle: (
        update: Update | readonly Update[],
        description?: string,
        autoFit?: AutoFitOptions,
    ) => void

    Apply a partial style to every selected range, as one undoable step.

    Type Declaration

      • (
            update: Update | readonly Update[],
            description?: string,
            autoFit?: AutoFitOptions,
        ): void
      • Parameters

        • update: Update | readonly Update[]

          The style delta, or a SEQUENCE of them applied in order.

        • Optionaldescription: string

          A messageKey('op.…') naming the step in the undo history.

        • OptionalautoFit: AutoFitOptions

          How the selection is fit afterwards, when the default style fit is not it.

        Returns void

    A sequence is how a caller expresses REPLACE rather than merge. A style delta merges into what is already there, and for a border stroke that means an absent color leaves the old one standing — there is no value for "no color" to write. Erasing the edge first and drawing it second says the whole thing, and the batch keeps it one step in the undo history.

    autoColor: IColor

    The color a border draws in when it has none of its own — the pickers' Automatic swatch.

    The same value, from the same place, as the toolbar's border picker gets from the formatBorder command context (see SheetCommands). Without it a picker has no way to offer "no color of my own", and the panel has to hand it some literal color instead — which then reads back as a custom swatch that the user never chose.

    cell: ICell

    The ANCHOR cell — the one the panels read their control values from, and the one the preview shows. A multi-cell selection has one style per cell; Excel reads the anchor too.

    createBorder: (properties: Partial<IBorders.Properties>) => IBorders | null

    Mints a detached border for the border diagram, the way the border picker's context does.

    createCell: (update: Update) => ICell | null

    Mints a detached cell for the previews (theme + named styles resolve against the workbook).

    darkMode: boolean

    Whether the GRID renders dark (not the app chrome) — previews and swatches follow the grid.

    disabled: boolean

    True when the selection cannot be formatted (a protected sheet).

    getEdgeStroke: (edge: Edge) => IStroke | null

    What is DRAWN on one edge of the selected block, sampled from the cell that carries it.

    A range's style object is cell-shaped: getBottom() on it answers for the style's own cell, not for the bottom of the block. So every edge is sampled from the cell it is drawn on — the outer edges from the block's CORNER cells (top and left from the top-left, bottom and right from the bottom-right), and each inner rule from the first cell across it: the horizontal from the top of the cell one row down, the vertical from the left of the cell one column over.

    The inner rules deliberately do NOT come from IBorders.getHorizontal/getVertical. Those report the RULE, which only exists while one authored block spans the whole selection: a border written at any other scope splits the blocks and the rule reads null forever after, and an imported workbook never has one at all (xlsx stores borders per cell). Read that way a covered-in-lines selection reports "no inner border", so the toggle can only ever draw.

    Sampling is direct: a border painted by a conditional format is not something this panel can clear, so counting it would make the toggle write none over an edge that stays on screen.

    hasInnerHorizontal: boolean

    Whether the selection spans more than one row / column — i.e. whether it HAS an inside.

    IBorders.Edge.Horizontal written to a single row lands nowhere: there is no shared edge to put it on. The border diagram greys those targets out rather than letting a click do nothing.

    hasInnerVertical: boolean

    Whether the selection spans more than one row / column — i.e. whether it HAS an inside.

    IBorders.Edge.Horizontal written to a single row lands nowhere: there is no shared edge to put it on. The border diagram greys those targets out rather than letting a click do nothing.

    schemeLookup: SchemeLookup

    Theme color resolution for the color pickers.

    sheet: ISheet

    The sheet the selection lives on.

    style: IStyle

    cell's resolved style.

    styles: IStyleCollection

    The workbook's style collection — theme swatches and recent colors for the pickers.