SheetXL - v0.3.20
    Preparing search index...

    Interface ISheetHeader

    Provides a programmatic interface for interacting with and modifying entire rows or columns in a spreadsheet, allowing for actions such as inserting, deleting, resizing, and applying formatting changes.

    interface ISheetHeader {
        addListeners(listeners: IListeners, options?: IListener.Options): Remove;
        at(index: number): ICellHeader;
        beginCommit(options?: string | OperationOptions): ITransaction;
        close(): void;
        doBatch<R = any>(
            callback: (commit: ICommit) => R | Promise<R>,
            options?: string | OperationOptions,
        ): R | Promise<R>;
        findIndex(offset: number): number;
        findOffset(index: number): number;
        findVisibleIndex(index: number): Readonly<RunCoords>;
        fromJSON(json: ISheetHeader.JSON): void;
        getDefaultSize(): number;
        getEntireRange(options?: GetRangeOptions): ICellHeaderRange;
        getMaxSize(): number;
        getMinSize(): number;
        getOrientation(): IRange.Orientation;
        getRange(
            address: ICellHeaderRange.Address,
            options?: GetRangeOptions,
        ): ICellHeaderRange;
        getScaleFactor(): number;
        getSelectedRange(options?: GetRangeOptions): ICellHeaderRange;
        getSelectedRuns(): readonly RunCoordValue<SelectedRun>[];
        getSheet(): ISheet;
        getSpanSize(indexFrom: number, indexTo?: number): number;
        getTextAt(index: number): string;
        getUsedRange(options?: GetRangeOptions): ICellHeaderRange;
        getUUID(): string;
        getVisibleCount(indexFrom: number, indexTo: number): number;
        hasHidden(): boolean;
        hiddenHeadersAt(index: number, reverse?: boolean): number;
        isClosed(): boolean;
        isProtected(): boolean;
        isSelected(index: number): boolean;
        isSelectedAll(index: number): boolean;
        setHidden(
            address: ICellHeaderRange.Address | readonly ICellHeaderRange.Address[],
            hidden?: boolean,
        ): this;
        setSize(
            address: ICellHeaderRange.Address | readonly ICellHeaderRange.Address[],
            size?: string | number,
            options?: SetSizeOptions,
        ): this;
        toJSON(): ISheetHeader.JSON;
        update(
            address: ICellHeaderRange.Address | readonly ICellHeaderRange.Address[],
            update: ICellHeader.Update,
            options?: UpdateHeadersOptions,
        ): this;
        updateHeaderPairs(
            pairs: AddressUpdatePair[],
            options?: UpdateHeadersOptions,
        ): RunCoords[];
    }

    Hierarchy (View Summary)

    Index

    Methods

    • Add Listeners.

      Parameters

      Returns Remove

      IListener.ISource.addListeners

    • Returns the header at a given offset. Will only return null for invalid header offset. To get a list of headers use getRange.

      Parameters

      • index: number

        0-based absolute index.

      Returns ICellHeader

    • Batches all 'transactional' changes until they have all be committed or rolled back.

      Parameters

      • Optionaloptions: string | OperationOptions

        Description of the operation or additional options. Used for tracking undo/redo and history. Default Value User Operation.

      Returns ITransaction

      Any changes that are made to this object will be reflected in the local record but not committed to the transactional store until the batch is popped.

      Useful for operations that are longer running but generally not recommended as it keeps a transaction open. doBatch is the preferred option.

    • Close the record and cleans resources. Can't be undone.

      Returns void

    • Provides a mechanism to perform a set of operations in a batch.

      Type Parameters

      • R = any

      Parameters

      • callback: (commit: ICommit) => R | Promise<R>

        A callback that performs multiple operations all within the same transaction.

      • Optionaloptions: string | OperationOptions

        Description of the operation or additional options. Used for tracking undo/redo and history. Default Value User Operation.

      Returns R | Promise<R>

    • Finds the index for the given header offset in pixels.

      Parameters

      • offset: number

        0-based pixels.

      Returns number

    • Finds the offset in pixels for the given header index

      Parameters

      • index: number

        0-based absolute index.

      Returns number

    • Finds the visibleIndex for a given absolute index.

      • If it's hidden it will return a range of 1 with a value before the offset and after.
      • If it's visible then it will return a range of 0 with the min and max that exactly match the offset.

      Parameters

      • index: number

        0-based absolute index.

      Returns Readonly<RunCoords>

      A RunCoords that can be used to determine if an index is hidden.

      If this is on the edge of the bounds this will return a +/- 1 the max bounds.

    • The default header size if not adjusted.

      Returns number

    • The maximum size of the header in native units.

      Returns number

    • The minimum size of the header in native units.

      Returns number

    • All header sizes are returned in pixels. This is done by multiplying the scaleFactor by the size on the cellHeader.

      Returns number

    • Returns the actives that are used in the selection.

      Parameters

      • Optionaloptions: GetRangeOptions

      Returns ICellHeaderRange

    • Returns a list of SelectedRuns.

      Returns readonly RunCoordValue<SelectedRun>[]

    • Returns the sheet model used for the header.

      Returns ISheet

    • Returns the size of the header in pixels. If a second argument is passed it will be the size of all the headers within the range. Note - It is expected that indexFrom will always be less than or equal to indexTo

      Parameters

      • indexFrom: number
      • OptionalindexTo: number

      Returns number

    • Returns a displayable title for the given index.

      Parameters

      • index: number

        0-based absolute index.

      Returns string

    • Returns the data ranges for headers that contain information.

      Parameters

      • Optionaloptions: GetRangeOptions

      Returns ICellHeaderRange

      • This is NOT the last cell that may have data or has been resized.
      • This also has nothing to do with the selection bounds.
    • A unique identifier for the record. This will never change.

      Returns string

      This enables the record to be identified across transactions and users in a collaborative environment.

    • Returns the number of indices visible. Between to indices.

      Parameters

      • indexFrom: number
      • indexTo: number

      Returns number

    • Returns true if any of the headers have the isHidden flag set to true or if any sizes are 0.

      Returns boolean

    • This is a very specific optimization function. When hiding many headers instead of scanning we can just skip. If 0 is returned then there are no hidden headers immediately following this one. If 1 is returned then only this header is hidden.

      Parameters

      • index: number

        The location to start the search.

      • Optionalreverse: boolean

        Indicates if search should scan in reverse. defaults to false.

      Returns number

      The number of headers following the index.

    • Returns true if no more operations are allowed.

      Returns boolean

    • Returns a flag indicating if the headers are protected by the sheet.

      Returns boolean

    • Returns true if header has a selection at the given index.

      Parameters

      • index: number

      Returns boolean

    • Returns true if header has a max selection at the given index.

      Parameters

      • index: number

      Returns boolean