createTableStyle

createTableStyle

BASIC / ADVANCED / PREMIUM

Creates a table style.

Description
public createTableStyle($name, $styles = array(), $options = array())

This method creates a custom table style.

Parameters

name

Style name.

styles

Avaible keys to set styles:

  • wholeTable
  • headerRow
  • totalRow
  • firstColumn
  • lastColumn
  • firstRowStripe
  • secondRowStripe
  • firstColumnStripe
  • secondColumnStripe
  • firstHeaderCell
  • lastHeaderCell
  • firstTotalCell
  • lastTotalCell

Key Type Description
backgroundColor string Hexadecimal color value: 'FFFF00', 'CCCCCC'...
bold bool If true the content will be shown in bold characters.
border string Border type: thin, thick, dashed, double, mediumDashDotDot, hair... This value can be overridden for each side with 'borderTop', 'borderRight', 'borderBottom', 'borderLeft' and 'borderDiagonal' properties.
borderColor string Hexadecimal color value: 'FFFF00', 'CCCCCC'... This value can be overridden for each side with 'borderColorTop', 'borderColorRight', 'borderColorBottom', 'borderColorLeft' and 'borderColorDiagonal' properties.
color string Hexadecimal color value: 'FF0000', '000000'...
font string Font family: 'Arial', 'Calibri'...
fontSize int Font size in points.
italic bool If true displays the content in italics.
strikethrough bool If true displays text in strikethrough.
underline string Underlines text: single, double.
Code samples

Example #1

The resulting XLSX looks like:

Release notes
  • phpxlsx 3.5:
    • font option.
  • phpxlsx 3.0:
    • new method.