Class

CellFormatComponent

CellFormatComponent

Helper component for defining cell formatting rules.

Since:
  • 5.0

Methods

withBackgroundColor(color) → {CellFormatComponent}

Set the cell background color.

Parameters:
Name Type Description
color string

A string that represents a 24-bit opaque color.

The CellFormatComponent itself.

Example
component
  .withBackgroundColor("#BEED0E");

withBottomBorder(width, color) → {CellFormatComponent}

Configure the bottom border of the cell.

Parameters:
Name Type Description
width number

The width of the border in px.

color string

A string that represents a 24-bit opaque color.

See:

The CellFormatComponent itself.

withBottomBorder(borderConfig) → {CellFormatComponent}

Configure the bottom border of the cell.

Parameters:
Name Type Description
borderConfig BorderConfig

Configuration object for the border.

See:

The CellFormatComponent itself.

withCellsToMergeHorizontally(cells) → {CellFormatComponent}

Set number of cells right to current cells to merge horizontally.

Parameters:
Name Type Description
cells number

Number of cells to merge. Has to be greater than 0.

The CellFormatComponent itself.

withFillType(fillType) → {CellFormatComponent}

Sets the fill type for the cell. For fill types 'solid' and 'pattern' the configured background color is used. 'gradient' will use the set gradients.

Parameters:
Name Type Description
fillType 'solid' | 'pattern' | 'gradient'

The fill type to use for the background of the cell. This is case sensitive.

See:

The CellFormatComponent itself.

withFont(family, size, color, boldopt, italicopt, underlineopt, strikeThroughopt) → {CellFormatComponent}

Set the font for the cell.

Parameters:
Name Type Attributes Default Description
family string

The name of the font family to use.

size number

The size of the font to set.

color string

A string that represents a 24-bit opaque color.

bold boolean <optional>
false

Flag whether the text shall be displayed bold.

italic boolean <optional>
false

Flag whether the text shall be displayed italic.

underline boolean <optional>
false

Flag whether the text shall be displayed underlined.

strikeThrough boolean <optional>
false

Flag whether the text shall be displayed stricken through.

The CellFormatComponent itself.

Examples
component
  .withFont("Arial", 12);
component
  .withFont("Wingdings", 42, false, false, true, false);

withFont(fontConfig) → {CellFormatComponent}

Set font for cell. When an optional property of the config is not specified, that part of the font format will not be changed from the font format of the report template.

Parameters:
Name Type Description
fontConfig FontConfig

The font configuration to apply.

The CellFormatComponent itself.

Example
component
  .withFont({
    family: "Webdings",
    size: 72,
    color: "#4A412A",
    style: "italic, underline"
  });

withGradientStops(gradientStopObj) → {CellFormatComponent}

Set list of gradient stops.

Parameters:
Name Type Description
gradientStopObj Array.<GradientStop>

An array of gradient stops to apply to the component.

The CellFormatComponent itself.

Example
component
  .withGradientStops([
    {
      color   : "#00FF00",
      position: 0.5
    },
    {
      color   : "#FFA0A0",
      position: 1
    }
  ]);

withImageAlignment(horizontalAlignment, verticalAlignment) → {CellFormatComponent}

Set the alignment of an image relative to the cell

Parameters:
Name Type Description
horizontalAlignment 'left' | 'center' | 'right'

The horizontal alignment of the picture. This is case insensitive.

verticalAlignment 'top' | 'center' | 'bottom'

The vertical alignment of the picture. This is case insensitive.

The CellFormatComponent itself.

withImageScaling(horizontalImageFraction, verticalImageFraction) → {CellFormatComponent}

Configure image size as relative fraction of regard to cell size

Parameters:
Name Type Description
horizontalImageFraction number

Fraction of cell width to which to scale image horizontally on the interval [0, 1]. Setting to e.g. 0.5 will scale image to half the width of table cell.

verticalImageFraction number

Fraction of cell width to which to scale image vertically on the interval [0, 1]. Setting to e.g. 0.5 will scale image to half the height of table cell.

The CellFormatComponent itself.

withLeftBorder(width, color) → {CellFormatComponent}

Configure the left border of the cell.

Parameters:
Name Type Description
width number

The width of the border in px.

color string

A string that represents a 24-bit opaque color.

See:

The CellFormatComponent itself.

withLeftBorder(borderConfig) → {CellFormatComponent}

Configure the left border of the cell.

Parameters:
Name Type Description
borderConfig BorderConfig

Configuration object for the border.

See:

The CellFormatComponent itself.

withNewGradientStop(position, color) → {CellFormatComponent}

Add a new gradient stop to the component style.

Parameters:
Name Type Description
position number

A value in the range of [0, 1] describing the gradient stop.

color string

A string that represents a 24-bit opaque color.

The CellFormatComponent itself.

Example
component
  .withNewGradientStop(0.13, "#BAEBAE");

withoutImageScaling() → {CellFormatComponent}

Configure image size as unchanged from original image source.

Note: When using both this and double), the last method called decides which scaling is applied.

The CellFormatComponent itself.

withRightBorder(width, color) → {CellFormatComponent}

Configure the right border of the cell.

Parameters:
Name Type Description
width number

The width of the border in px.

color string

A string that represents a 24-bit opaque color.

The CellFormatComponent itself.

Example
component
  .withRightBorder(2, "#AA3344");

withRightBorder(borderConfig) → {CellFormatComponent}

Configure the right border of the cell.

Parameters:
Name Type Description
borderConfig BorderConfig

Configuration object for the border.

The CellFormatComponent itself.

Example
component
  .withRightBorder({
    color  : "#FAB100",
    visible: true,
    width  : 2
  });

withStyle(cellStyle) → {CellFormatComponent}

Set all cell styles contained in javascript object. Will not change settings for missing properties (e.g. font config will not be reset when javascript object does not contain a font property)

Parameters:
Name Type Description
cellStyle CellStyle

Javascript object containing styling properties.

The CellFormatComponent itself.

withTopBorder(width, color) → {CellFormatComponent}

Configure the top border of the cell.

Parameters:
Name Type Description
width number

The width of the border in px.

color string

A string that represents a 24-bit opaque color.

See:

The CellFormatComponent itself.

withTopBorder(borderConfig) → {CellFormatComponent}

Configure the top border of the cell.

Parameters:
Name Type Description
borderConfig BorderConfig

Configuration object for the border.

See:

The CellFormatComponent itself.

withTrimAfterMerge(trim) → {CellFormatComponent}

Configure whether strings will be trimmed after merging cells. This is best used together with #withCellsToMergeHorizontally

Parameters:
Name Type Description
trim boolean

Flag whether to trim strings after merge.

The CellFormatComponent itself.