FormatOptions class (Pivot)

FormatOptions()

new FormatOptions()

The FormatOptions type holds options a pivot-column can be formated as. The FormatOptions type defines the following fields: expression {string}, defines the format's expression; key {string}, specifies the key associated with the format; shape {any}, defines the shape to apply on the cell. The FormatOptions type is used by the control's format-appearances and format-conditional-appearances, as the value of each format. The FormatAppearances property holds the format-appearances that defines the visual-appearance to apply on pivot-columns. The FormatConditionalAppearances property holds the format-appearances that are applied based on conditions. The FormatContents property holds information about how a column or row can be displayed, formatted or converted.

Members

(static) expression :string

The expression field defines the conditional format or the format to display the cell/column's content. The expression is applied on the cell / column based on the format-appearances and format-conditional-appearances. The format-appearances are applied after the format-contents, but before the format-conditional-appearances. The format-appearances are applied to any aggregate-column, pivot-row item, total or sub-total item. The conditional-appearance is not supported for pivot-row item, total or sub-total item. The format-appearances are applied based on the flags defined within the options of pivotRows and pivotColumns properties. The FormatConditionalAppearances property holds the format-appearances that are applied based on conditions. The FormatContents property holds information about how a column or row can be displayed, formatted or converted.

The expression supports the following keywords:

value, gets the value of the cell being formatted/evaluated
The expression supports the following variables:
%0, %1, %2, ... specifies the value of the cell in the conditional format with the index 0, 1 2, ...
%C0, %C1, %C2, ... specifies the caption of the cell, or the string the cell displays in the conditional format with the index 0, 1 2, ...
%CD0, %CD1, %CD2, ... specifies the cell's user-date in the conditional format with the index 0, 1 2, ...
%CS0, %CS1, %CS2, ... specifies the cell's state in the conditional format with the index 0, 1 2, ...
The expression supports the following functions:
index, gets the index of the item
rindex, returns the recursive-index of the item
pos, returns the relative position of the item (the position within the parent's children collection)
rpos, returns the recursive relative-position of the item (the position within the parent's children collection)
opos, returns the relative old position of the item (the position within the parent's children collection)
ropos, returns the recursive relative-old-position of the item (the position within the parent's children collection)
apos, returns the absolute position of the item (the position from the first visible item)
rapos, returns the recursive absolute-position of the item (the position from the first visible item)
Type:
  • string
Example
"1" {string}, highlights all cells or items.
"%0 >= 0" {string}, highlights the cells or items, when the cells in the first conditional format have the value greater or equal with zero
"%0 startwith 'A'" {string}, highlights the cells or items, when the cells in the first column starts with A
expression

(static) key :string

The key field specifies the key associated with the format. The key can be used to identify the format, for instance, when you want to apply the same format for different columns or rows, you can set the same key for each format, and then use the key to apply the format on each column or row. The key is not required, and if missing, the format is applied without being associated with any key.
Type:
  • string
Example
"bold" {string}, specifies the key of the format.
key

(static) shape :any

The shape field defines the shape to apply on the cell / column. The shape is applied on the cell / column based on the format-appearances and format-conditional-appearances. The format-appearances are applied after the format-contents, but before the format-conditional-appearances. The format-appearances are applied to any aggregate-column, pivot-row item, total or sub-total item. The conditional-appearance is not supported for pivot-row item, total or sub-total item. The format-appearances are applied based on the flags defined within the options of pivotRows and pivotColumns properties. The FormatConditionalAppearances property holds the format-appearances that are applied based on conditions. The FormatContents property holds information about how a column or row can be displayed, formatted or converted.

The shape field can be any of the following:

  • the shape's name within the exontrol.Shapes.Tree or exontrol.Shapes namespace
  • a CSS color
  • a JSON string-representation of an object of exontrol.Def.Shape type, for the column itself
  • an object of {normal,hover,click,disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.Shape type
Type:
  • any
Example
"" {string}, null {null}, no shape is applied
"red" {string}, fills the object's background in red (CSS color)
'{"fillColor": "red"}' or '{"normal":{"fillColor": "red"}}' {string}, fills the object's background in red (JSON-representation of an object of exontrol.Def.Shape type)
"xxx" {string}, indicates that exontrol.Shapes.Pivot.xxx or exontrol.Shapes.xxx is applied on the object's background. If the xxx field is missing, no custom shape is applied (no default object's shape is be applied)
"Button" or exontrol.Shapes.Button {object}, applies the "Button" shape on the object as defined into exontrol.Shapes namespace (@since 5.2)
shape