Interface INamedItems

Holds a collection of named ranges

interface INamedItems {
    isNamedItems: true;
    addListener(listener): RemoveListener;
    addNamedRange(namedRange, replaceHidden?): NamedRangeItem;
    decodeAddress(address): SheetCellRangeCoords[];
    deleteNamedRange(namedRange): NamedRangeItem;
    findValidateName(ranges, scope?, template?, replaceHidden?): string;
    fromJSON(json): void;
    lookupByName(name, anchor): NamedItem<CellRangeCoords>;
    lookupByRanges(ranges, anchor): NamedItem<CellRangeCoords>[];
    search(options?): NamedItem<CellRangeCoords>[];
    toJSON(): NamedItemsJSON;
    updateNamedRange(name, namedRange): NamedRangeItem;
    validateNamedItem(namedRangeItem, scope?, replaceHidden?): void;
}

Implemented by

Properties

isNamedItems: true

Used for runtime reflection.

Methods

  • Add a named range. This is case insensitive; must be unique, and must not have any spaces. This will throw an error if the name is invalid or already exists,

    Parameters

    • namedRange: string | Partial<{
          comment?: string;
          hidden?: string | Partial<boolean>;
          name: string;
          ref: string | SheetCellRangeCoords[] | (string | SheetCellRangeCoords | Partial<{
              colEnd: string | number;
              colStart: string | number;
              fixedColEnd?: string | Partial<boolean>;
              fixedColStart?: string | Partial<boolean>;
              fixedRowEnd?: string | Partial<boolean>;
              fixedRowStart?: string | Partial<boolean>;
              rowEnd: string | number;
              rowStart: string | number;
              sheetName: string;
          }>)[];
          scope?: string;
          type: string;
      }>
    • Optional replaceHidden: boolean

      If true will replace hidden ranges if one already exists.

    Returns NamedRangeItem

    Default Value

    true
    
  • Given the name return a valid name that closely matches.

    Parameters

    • ranges: SheetCellRangeCoords[]
    • Optional scope: string
    • Optional template: string
    • Optional replaceHidden: boolean

    Returns string

  • Loads value from JSON, this will clear any existing state

    Parameters

    Returns void

  • Updates a named range. This allows for the original name to be changed.

    Parameters

    • name: string

      The original name

    • namedRange: Partial<{
          comment?: string;
          hidden?: string | Partial<boolean>;
          name: string;
          ref: string | SheetCellRangeCoords[] | (string | SheetCellRangeCoords | Partial<{
              colEnd: string | number;
              colStart: string | number;
              fixedColEnd?: string | Partial<boolean>;
              fixedColStart?: string | Partial<boolean>;
              fixedRowEnd?: string | Partial<boolean>;
              fixedRowStart?: string | Partial<boolean>;
              rowEnd: string | number;
              rowStart: string | number;
              sheetName: string;
          }>)[];
          scope?: string;
          type: string;
      }>

    Returns NamedRangeItem

  • Validate that the NamedItem. This is identical to addNamedItem but without actually trying.

    Parameters

    • namedRangeItem: Partial<{
          comment?: string;
          hidden?: string | Partial<boolean>;
          name: string;
          ref: string | SheetCellRangeCoords[] | (string | SheetCellRangeCoords | Partial<{
              colEnd: string | number;
              colStart: string | number;
              fixedColEnd?: string | Partial<boolean>;
              fixedColStart?: string | Partial<boolean>;
              fixedRowEnd?: string | Partial<boolean>;
              fixedRowStart?: string | Partial<boolean>;
              rowEnd: string | number;
              rowStart: string | number;
              sheetName: string;
          }>)[];
          scope?: string;
          type: string;
      }>

      The range to validate

    • Optional scope: string

      The scope of the range.

    • Optional replaceHidden: boolean

      If true then won't check to see if the name is already used for hidden ranges.

    Returns void

    Remarks

    This will throw an error if the sheetName is invalid.

    Default Value

    true
    

    Default Value

    null