Represents a column in a [[WorksheetTable]].

Each column contains various settings for controlling the contents, formatting, sorting, and filtering within it.

Hierarchy

Hierarchy

  • Base
    • WorksheetTableColumn

Implements

Constructors

Properties

$type: Type
$t: Type
nextHashCode: number

Accessors

  • get columnFormula(): Formula
  • Gets the formula associated with the data area of the column.

    When the column formula is set and the table is resized to give it more rows, the new cells in the column will have the column formula applied to them.

    A [[Formula]] instance representing the formula for the data area of the column or null if no formula is applied.

    See

    [[setColumnFormula]]

    Returns Formula

  • get dataAreaRegion(): WorksheetRegion
  • Gets the [[WorksheetRegion]] which represents the region of cells in the data area of the column.

    Returns WorksheetRegion

  • get filter(): Filter
  • Gets the filter applied to the column.

    Filters are not constantly evaluated as data within the table changes. Filters are applied to the table only when they are added or removed on a column in the table or when the [[WorksheetTable.reapplyFilters]] method is called.

    Note: When the filters are reevaluated, the rows of any cells which don't meet the filter criteria of their column will be hidden. When a row is filtered out, the entire row is hidden from the worksheet, so any data outside the table but in the same row will also be hidden.

    A [[filter]]-derived instance if a filter is applied or null if the column is not filtered.

    See

    • [[applyAverageFilter]]
    • [[applyCustomFilter]]
    • [[applyCustomFilter]]
    • [[applyDatePeriodFilter]]
    • [[applyFontColorFilter]]
    • [[applyFontColorFilter]]
    • [[applyFixedValuesFilter]]
    • [[applyFixedValuesFilter]]
    • [[applyFixedValuesFilter]]
    • [[applyFixedValuesFilter]]
    • [[applyRelativeDateRangeFilter]]
    • [[applyTopOrBottomFilter]]
    • [[applyTopOrBottomFilter]]
    • [[applyYearToDateFilter]]
    • [[clearFilter]]
    • [[WorksheetTable.clearFilters]]
    • [[WorksheetTable.reapplyFilters]]

    Returns Filter

  • set filter(a): void
  • Parameters

    Returns void

  • get headerCell(): WorksheetCell
  • Gets the [[WorksheetCell]] which represents the header cell for the column. A WorksheetCell which represents the header cell for the column or null if the header row is not visible in the table.

    See

    [[WorksheetTable.isHeaderRowVisible]]

    Returns WorksheetCell

  • get index(): number
  • Gets the 0-based index of the column in the owning [[WorksheetTable.columns]] collection. The 0-based index of the column in its collection or -1 if the column has been removed from the table.

    See

    [[WorksheetTable.columns]]

    Returns number

  • get name(): string
  • Gets or sets the name of the column.

    If the header row is visible in the [[WorksheetTable]], the name of the column will be displayed in the cell of the column in the header row.

    When the WorksheetTable is created, the column names will be taken from the cells in the header row. If the table does not contain a header row, the column names will be generated.

    The column names are unique within the owning WorksheetTable. If, when the table is created, there are two or more columns with the same name, the second and subsequent duplicate column names will have a number appended to make them unique. If any cells in the header row have a non-string value, their value will be changed to a string (the current display text of the cell). If any cells in the header row have no value, they will be given a generated column name.

    If the Name property is set to a null or empty string, a column name will be generated. If the value is set to a column name which already exists in the table, the column with the higher index will have a number appended to its name so all column names can stay unique.

    The unique name of the column within the owning WorksheetTable.

    Throws

    [[InvalidOperationException]] From the setter if column was removed from the table.

    See

    [[WorksheetTable.isHeaderRowVisible]]

    Returns string

  • set name(a): void
  • Parameters

    • a: string

    Returns void

  • get sortCondition(): SortCondition
  • Gets or sets the sort condition used to sort the column in the table.

    When a sort condition is set on the column, the SortConditions collection on the [[WorksheetTable.sortSettings]] will be cleared and the new sort condition will be added. To sort by multiple columns, the sort conditions must be added to the SortConditions collection instead of set on the column. However, if a sort condition is cleared with this property, just the sort condition for the column will be removed from the SortConditions collection. All other SortConditions will remain in the collection.

    Note: Sort conditions are not constantly evaluated as data within the table changes. Sort conditions are applied to the table only when they are are added or removed on a column in the table or when the [[WorksheetTable.reapplySortConditions]] method is called.

    The [[sortCondition]]-derived instance used to sort the column or null of the column is not sorted.

    Throws

    [[InvalidOperationException]] From the setter if column was removed from the table.

    See

    • [[WorksheetTable.sortSettings]]
    • [[SortSettings1.sortConditions]] @see [[SortConditionCollection1]]
    • [[WorksheetTable.clearSortConditions]]
    • [[WorksheetTable.reapplySortConditions]]

    Returns SortCondition

  • set sortCondition(a): void
  • Parameters

    Returns void

  • get table(): WorksheetTable
  • Gets the [[WorksheetTable]] to which the column belongs. The WorksheetTable to which the column belongs or null if the column has been removed from the table.

    Returns WorksheetTable

  • get totalCell(): WorksheetCell
  • Gets the [[WorksheetCell]] which represents the total cell for the column. A WorksheetCell which represents the total cell for the column or null if the totals row is not visible in the table.

    See

    [[WorksheetTable.isTotalsRowVisible]]

    Returns WorksheetCell

  • get totalFormula(): Formula
  • Gets or sets the formula to use in the total cell of the column.

    The total formula can be set regardless of whether or not the totals row is visible. If the totals row is hidden, the formula will not be applied anywhere. When the totals row is visible, it will be applied to the total cell of the column.

    Setting the TotalFormula to a non-null value will clear the [[totalLabel]], and vice versa.

    Throws

    [[ArgumentException]] The value is already applied to something else, such as a cell or table column.

    Throws

    [[InvalidOperationException]] From the setter if column was removed from the table.

    See

    • [[totalLabel]]
    • [[WorksheetTable.isTotalsRowVisible]]

    Returns Formula

  • set totalFormula(a): void
  • Parameters

    Returns void

  • get totalLabel(): string
  • Gets or sets the text label to use in the total cell of the column.

    The total label can be set regardless of whether or not the totals row is visible. If the totals row is hidden, the label will not be displayed anywhere. When the totals row is visible, it will be set as the value of the total cell of the column.

    Setting the [[totalFormula]] to a non-null value will clear the TotalLabel, and vice versa.

    Throws

    [[InvalidOperationException]] From the setter if column was removed from the table.

    See

    • [[totalFormula]]
    • [[WorksheetTable.isTotalsRowVisible]]

    Returns string

  • set totalLabel(a): void
  • Parameters

    • a: string

    Returns void

  • get wholeColumnRegion(): WorksheetRegion
  • Gets the [[WorksheetRegion]] which represents the region of cells in the whole column, including the header and total cells, if visible.

    Returns WorksheetRegion

Methods

  • Applies an [[AverageFilter]] to the column.

    Throws

    [[InvalidEnumArgumentException]] 'type' is not defined in the [[AverageFilterType]] enumeration.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    See

    • [[AverageFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    • type: AverageFilterType

      The value indicating whether to filter in values below or above the average of the data range.

    Returns AverageFilter

  • Applies a [[CustomFilter]] to the column.

    Note: If the filter condition value is longer than 255 characters in length and the workbook is saved in one of the 2003 formats, the correct rows will be hidden in the saved file, but the filter will be missing from the column.

    Throws

    [[ArgumentNullException]] 'condition' is null.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    See

    • [[CustomFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    Returns CustomFilter

  • Applies a [[CustomFilter]] to the column.

    If 'condition2' is null, the 'conditionalOperator' value is irrelevant.

    Note: If one of the filter condition values is longer than 255 characters in length and the workbook is saved in one of the 2003 formats, the correct rows will be hidden in the saved file, but the filter will be missing from the column.

    Throws

    [[ArgumentNullException]] 'condition1' is null.

    Throws

    [[InvalidEnumArgumentException]] 'conditionalOperator' is not defined in the [[ConditionalOperator]] enumeration.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    See

    • [[CustomFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    Returns CustomFilter

  • Applies an [[DatePeriodFilter]] to the column.

    If the 'type' is Month, a 'value' of 1 indicates January, 2 indicates February, and so on. If type is Quarter, a value of 1 indicates Quarter 1, and so on.

    Throws

    [[InvalidEnumArgumentException]] 'type' is not defined in the [[DatePeriodFilterType]] enumeration.

    Throws

    [[ArgumentException]] 'type' is Quarter and 'value' is less than 1 or greater than 4 or type is Month and value is less than 1 or greater than 12.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    See

    • [[DatePeriodFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    • type: DatePeriodFilterType

      The type of date period to filter in.

    • value: number

      The 1-based value of the month or quarter to filter in.

    Returns DatePeriodFilter

  • Applies a [[FillFilter]] to the column.

    Throws

    [[ArgumentNullException]] 'fill' is null.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    See

    • [[FillFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    • fill: CellFill

      A [[CellFill]] by which the cells should be filtered.

    Returns FillFilter

  • Applies a [[FixedValuesFilter]] to the column.

    Throws

    [[ArgumentNullException]] 'dateGroups' is null.

    Throws

    [[InvalidEnumArgumentException]] 'calendarType' is not defined in the [[CalendarType]] enumeration.

    Throws

    [[ArgumentNullException]] A FixedDateGroup in the 'dateGroups' collection is null.

    Throws

    [[ArgumentException]] Multiple items in 'dateGroups' are equal to each other.

    Throws

    [[InvalidOperationException]] 'includeBlanks' is False and 'dateGroups' has no items. At least one value must be allowed.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    See

    • [[FixedValuesFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    • includeBlanks: boolean

      The value which indicates whether blank cells should be filtered in.

    • calendarType: CalendarType

      The calendar type used to interpret values in the 'dateGroups' collection.

    • Rest ...dateGroups: FixedDateGroup[]

      The collection of fixed date groups which should be filtered in.

    Returns FixedValuesFilter

  • Applies a [[FontColorFilter]] to the column.

    Throws

    [[ArgumentNullException]] 'fontColorInfo' is null.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    See

    • [[FontColorFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    • fontColorInfo: WorkbookColorInfo

      A [[WorkbookColorInfo]] which describes the font color by which the cells should be filtered.

    Returns FontColorFilter

  • Applies a [[FontColorFilter]] to the column.

    Throws

    [[ArgumentNullException]] 'fontColor' is empty.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    See

    • [[FontColorFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    • fontColor: string | Color

      The font color by which the cells should be filtered.

    Returns FontColorFilter

  • Applies a [[IconFilter]] to the column.

    Throws

    [[ArgumentException]] If the icon set is not valid.

    Throws

    [[ArgumentOutOfRangeException]] If the index is less than zero or greater than or equal to the number of icons in the icon set..

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    Throws

    [[InvalidEnumArgumentException]] 'iconSet' is not defined in the [[FormatConditionIconSet]] enumeration.

    See

    • [[IconFilter]]
    • [[filter]]
    • [[clearFilter]]
    • [[ConditionalFormatCollection.addIconSetCondition]]

    Parameters

    • iconSet: FormatConditionIconSet

      The icon set containing the icon.

    • iconIndex: number

      The zero-based index of the icon in the set or null for 'NoCellIcon'.

    Returns IconFilter

  • Applies a [[RelativeDateRangeFilter]] to the column.

    The RelativeDateRangeFilter allows you to filter in dates which are in the previous, current, or next time period relative to the date when the filter was applied. The time periods available are day, week, month, quarter, year. So when using the previous filter type with a day duration, a 'yesterday' filter is created. Or when using a current filter type with a year duration, a 'this year' filter is created. However, these filters compare the data against the date when the filter was created. So a 'this year' filter created in 1999 will filter in all cells containing dates in 1999, even if the workbook is opened in 2012.

    Throws

    [[InvalidEnumArgumentException]] 'offset' is not defined in the [[RelativeDateRangeOffset]] enumeration.

    Throws

    [[InvalidEnumArgumentException]] 'duration' is not defined in the [[RelativeDateRangeDuration]] enumeration.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    See

    • [[RelativeDateRangeFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    Returns RelativeDateRangeFilter

  • Applies a [[TopOrBottomFilter]] to the column which will filter in the top 10 values in the list of sorted values.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    See

    • [[TopOrBottomFilter]]
    • [[filter]]
    • [[clearFilter]]

    Returns TopOrBottomFilter

  • Applies a [[TopOrBottomFilter]] to the column.

    Throws

    [[InvalidEnumArgumentException]] 'type' is not defined in the [[TopOrBottomFilterType]] enumeration.

    Throws

    [[ArgumentOutOfRangeException]] 'value' is less than 1 or greater than 500.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    See

    • [[TopOrBottomFilter]]
    • [[filter]]
    • [[clearFilter]]

    Parameters

    • type: TopOrBottomFilterType

      The type of the filter.

    • value: number

      The number or percentage of value of values which should be filtered in.

    Returns TopOrBottomFilter

  • Applies a [[YearToDateFilter]] to the column.

    Throws

    [[InvalidOperationException]] The [[WorksheetTable.isFilterUIVisible]] value of the owning table is False. Filters cannot be applied when the header row or filter button is hidden.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    See

    • [[YearToDateFilter]]
    • [[filter]]
    • [[clearFilter]]

    Returns YearToDateFilter

  • Gets the format for the specified area. An [[IWorksheetCellFormat]] instance describing the appearance of the specified area.

    Throws

    [[InvalidEnumArgumentException]] 'area' is not defined.

    Parameters

    Returns IWorksheetCellFormat

  • Gets the collection of formats used for each area of the column.

    The available areas of the column which can have a format set are the header, data, and totals areas.

    Applying a format to an area will apply the format to all cells in that area.

    If any area formats on the columns are set when the table is resized to give it more rows, the new cells in the column will get the new format applied.

    See

    • [[filter]]
    • [[WorksheetTable.areaFormats]]
    • [[WorksheetTableStyle.areaFormats]]
    • [[WorksheetTable.resize]]
    • [[WorksheetTable.resize]]

    Returns WorksheetTableAreaFormatsCollection$1<WorksheetTableColumnArea>

  • Removes the filter from the column if one is applied.

    Throws

    [[InvalidOperationException]] If column was removed from the table.

    See

    • [[applyAverageFilter]]
    • [[applyCustomFilter]]
    • [[applyCustomFilter]]
    • [[applyDatePeriodFilter]]
    • [[applyFillFilter]]
    • [[applyFixedValuesFilter]]
    • [[applyFixedValuesFilter]]
    • [[applyFixedValuesFilter]]
    • [[applyFixedValuesFilter]]
    • [[applyFontColorFilter]]
    • [[applyFontColorFilter]]
    • [[applyRelativeDateRangeFilter]]
    • [[applyTopOrBottomFilter]]
    • [[applyTopOrBottomFilter]]
    • [[applyYearToDateFilter]]
    • [[filter]]

    Returns void

  • Parameters

    • other: any

    Returns boolean

  • Returns number

  • Returns Base

  • Sets the formula to use in the data cells in the column.

    If any relative cell or region references are in the specified formula, it will be assumed that the actual formula is being applied to the first data cell in the column. When the formula is applied to other cells in the column, the relative references will be offset by the appropriate amount.

    When the column formula is set and the table is resized to give it more rows, the new cells in the column will have the column formula applied to them.

    If there was a different column formula applied previously and it was applied to any of the cells in the column, setting it to a different formula will overwrite the formulas on those cells, regardless of the value of 'overwriteExistingValues'.

    Throws

    [[ArgumentException]]

    Throws

    [[InvalidOperationException]] If column was removed from the table. 'formula' is already applied to something else, such as a cell or table column.

    See

    [[columnFormula]]

    Parameters

    • formula: Formula

      The formula for the data cells of the column or null to remove the current column formula.

    • overwriteExistingValues: boolean

      True to overwrite the existing cells values and apply the formula to all data cells in the column. False to only apply the formula to the cells with no value set.

    Returns void

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns number

  • Parameters

    • item1: any
    • item2: any

    Returns boolean

  • Parameters

    • a: any
    • b: any

    Returns boolean

  • Parameters

    • obj: any

    Returns any[]

  • Parameters

    • obj: any

    Returns any[]

  • Parameters

    • obj: any

    Returns number

  • Parameters

    • a: any
    • b: any

    Returns boolean