Creates a cell style.

public createCellStyle($name, $styles = array(), $options = array())

This method creates a custom cell style. If the custom style name already exists it's not added.



Style name.

Preset style names: Bad, Calculation, Check Cell, Comma, Currency, Explanatory Text, Good, Heading 1, Heading 2, Heading 3, Heading 4, Input, Linked Cell, Neutral, Normal, Note, Output, Percent, Warning Text


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.
horizontalAlign string left, center, right.
indent int Indent value.
italic bool If true displays the content in italics.
locked bool Locked property.
rotation int Orientation degrees.
shrinkToFit bool If true enables shrink to fit.
strikethrough bool If true displays text in strikethrough.
subscript bool If true displays text in subscript.
superscript bool If true displays text in superscript.
textDirection string context, ltr, rtl.
typeOptions array Keys and values:
  • formatCode (string)
underline string Underlines text: single, double.
verticalAlign string top, center, bottom.
wrapText bool If true enables wrap text.


Key Type Description
hidden bool Hidden attribute. Default as false.
Code samples

Example #1

The resulting XLSX looks like:

Release notes
  • phpxlsx 2.0:
    • new method.