Table extends Border
Border style
Table of Contents
- LAYOUT_AUTO = 'autofit'
- AutoFit Table Layout
- LAYOUT_FIXED = 'fixed'
- Fixed Width Table Layout
- WIDTH_AUTO = 'auto'
- WIDTH_PERCENT = 'pct'
- WIDTH_TWIP = 'dxa'
- $aliases : array<string|int, mixed>
- Aliases
- $borderBottomColor : string
- Border Bottom Color
- $borderBottomSize : int|float
- Border Bottom Size
- $borderBottomStyle : string
- Border Bottom Style
- $borderLeftColor : string
- Border Left Color
- $borderLeftSize : int|float
- Border Left Size
- $borderLeftStyle : string
- Border Left Style
- $borderRightColor : string
- Border Right Color
- $borderRightSize : int|float
- Border Right Size
- $borderRightStyle : string
- Border Right Style
- $borderTopColor : string
- Border Top Color
- $borderTopSize : int|float
- Border Top Size
- $borderTopStyle : string
- Border Top Style
- $cellSpacing : int|float
- $index : int|null
- Index number in Style collection for named style
- $styleName : string
- Style name
- $alignment : string
- $bidiVisual : bool
- Visually Right to Left Table
- $borderInsideHColor : string
- Border color inside horizontal
- $borderInsideHSize : int
- Border size inside horizontal
- $borderInsideVColor : string
- Border color inside vertical
- $borderInsideVSize : int
- Border size inside vertical
- $cellMarginBottom : int
- Cell margin bottom
- $cellMarginLeft : int
- Cell margin left
- $cellMarginRight : int
- Cell margin right
- $cellMarginTop : int
- Cell margin top
- $columnWidths : array<string|int, int>
- The width of each column, computed based on the max cell width of each column
- $firstRowStyle : Table
- Style for first row
- $indent : TblWidth|null
- $isAuto : bool
- Is this an automatic style? (Used primarily in OpenDocument driver)
- $isFirstRow : bool
- Is this a first row style?
- $layout : string
- $position : TablePosition
- Position
- $shading : Shading
- Shading
- $unit : string
- $width : int|float
- __construct() : mixed
- Create new table style
- getAlign() : string
- getAlignment() : string
- getBgColor() : string
- Get background
- getBorderBottomColor() : string
- Get border bottom color
- getBorderBottomSize() : int|float
- Get border bottom size
- getBorderBottomStyle() : string
- Get border bottom style
- getBorderColor() : array<string|int, string>
- Get TLRBHV Border Color
- getBorderInsideHColor() : string
- Get border color inside horizontal
- getBorderInsideHSize() : int
- Get border size inside horizontal
- getBorderInsideVColor() : string
- Get border color inside vertical
- getBorderInsideVSize() : int
- Get border size inside vertical
- getBorderLeftColor() : string
- Get border left color
- getBorderLeftSize() : int|float
- Get border left size
- getBorderLeftStyle() : string
- Get border left style
- getBorderRightColor() : string
- Get border right color
- getBorderRightSize() : int|float
- Get border right size
- getBorderRightStyle() : string
- Get border right style
- getBorderSize() : array<string|int, int>
- Get TLRBHV Border Size
- getBorderStyle() : array<string|int, string>
- Get border style
- getBorderTopColor() : string
- Get border top color
- getBorderTopSize() : int|float
- Get border top size
- getBorderTopStyle() : string
- Get border top style
- getCellMargin() : array<string|int, int>
- Get cell margin
- getCellMarginBottom() : int
- Get cell margin bottom
- getCellMarginLeft() : int
- Get cell margin left
- getCellMarginRight() : int
- Get cell margin right
- getCellMarginTop() : int
- Get cell margin top
- getCellSpacing() : float|int
- getChildStyleValue() : mixed
- Return style value of child style object, e.g. `left` from `Indentation` child style of `Paragraph`
- getColumnWidths() : null|array<string|int, int>
- Get the columnWidths
- getFirstRow() : Table
- Set first row
- getIndent() : TblWidth
- getIndex() : int|null
- Get index number
- getLayout() : string
- Get layout
- getPosition() : TablePosition
- Get position
- getShading() : Shading
- Get shading
- getStyleName() : string
- Get style name
- getUnit() : string
- Get width unit
- getWidth() : int|float
- Get width
- hasBorder() : bool
- Check if any of the border is not null
- hasMargin() : bool
- Check if any of the margin is not null
- isAuto() : bool
- Get is automatic style flag
- isBidiVisual() : bool
- Get bidiVisual
- setAlign() : self
- setAlignment() : self
- setArrayStyle() : self
- Set style using associative array
- setAuto() : self
- Set is automatic style flag
- setBgColor() : self
- Set background
- setBidiVisual() : self
- Set bidiVisual
- setBorderBottomColor() : self
- Set border bottom color
- setBorderBottomSize() : self
- Set border bottom size
- setBorderBottomStyle() : self
- Set border bottom style
- setBorderColor() : self
- Set TLRBHV Border Color
- setBorderInsideHColor() : self
- Set border color inside horizontal
- setBorderInsideHSize() : self
- Set border size inside horizontal
- setBorderInsideVColor() : self
- Set border color inside vertical
- setBorderInsideVSize() : self
- Set border size inside vertical
- setBorderLeftColor() : self
- Set border left color
- setBorderLeftSize() : self
- Set border left size
- setBorderLeftStyle() : self
- Set border left style
- setBorderRightColor() : self
- Set border right color
- setBorderRightSize() : self
- Set border right size
- setBorderRightStyle() : self
- Set border right style
- setBorderSize() : self
- Set TLRBHV Border Size
- setBorderStyle() : self
- Set border style
- setBorderTopColor() : self
- Set border top color
- setBorderTopSize() : self
- Set border top size
- setBorderTopStyle() : self
- Set border top Style
- setCellMargin() : self
- Set TLRB cell margin
- setCellMarginBottom() : self
- Set cell margin bottom
- setCellMarginLeft() : self
- Set cell margin left
- setCellMarginRight() : self
- Set cell margin right
- setCellMarginTop() : self
- Set cell margin top
- setCellSpacing() : mixed
- setColumnWidths() : mixed
- The column widths
- setIndent() : self
- setIndex() : self
- Set index number
- setLayout() : self
- Set layout
- setPosition() : self
- Set position
- setShading() : self
- Set shading
- setStyleByArray() : self
- Set style by using associative array
- setStyleName() : self
- Set style name
- setStyleValue() : self
- Set style value template method
- setUnit() : self
- Set width unit
- setWidth() : self
- Set width
- setBoolVal() : bool
- Set bool value
- setEnumVal() : mixed
- Set enum value
- setFloatVal() : float|null
- Set float value: Convert string that contains only numeric into float
- setIntVal() : int|null
- Set integer value: Convert string that contains only numeric into integer
- setNonEmptyVal() : string
- Set default for null and empty value
- setNumericVal() : int|float|null
- Set numeric value
- setObjectVal() : mixed
- Set object value
- setPairedVal() : self
- Set $property value and set $pairProperty = false when $value = true
- getTableOnlyProperty() : int|string|null
- Get table style only property by checking if it's a firstRow
- setTableOnlyProperty() : self
- Set table style only property by checking if it's a firstRow
Constants
LAYOUT_AUTO
AutoFit Table Layout
public
string
LAYOUT_AUTO
= 'autofit'
LAYOUT_FIXED
Fixed Width Table Layout
public
string
LAYOUT_FIXED
= 'fixed'
WIDTH_AUTO
public
mixed
WIDTH_AUTO
= 'auto'
Tags
WIDTH_PERCENT
public
mixed
WIDTH_PERCENT
= 'pct'
Tags
WIDTH_TWIP
public
mixed
WIDTH_TWIP
= 'dxa'
Tags
Properties
$aliases
Aliases
protected
array<string|int, mixed>
$aliases
= array()
$borderBottomColor
Border Bottom Color
protected
string
$borderBottomColor
$borderBottomSize
Border Bottom Size
protected
int|float
$borderBottomSize
$borderBottomStyle
Border Bottom Style
protected
string
$borderBottomStyle
$borderLeftColor
Border Left Color
protected
string
$borderLeftColor
$borderLeftSize
Border Left Size
protected
int|float
$borderLeftSize
$borderLeftStyle
Border Left Style
protected
string
$borderLeftStyle
$borderRightColor
Border Right Color
protected
string
$borderRightColor
$borderRightSize
Border Right Size
protected
int|float
$borderRightSize
$borderRightStyle
Border Right Style
protected
string
$borderRightStyle
$borderTopColor
Border Top Color
protected
string
$borderTopColor
$borderTopSize
Border Top Size
protected
int|float
$borderTopSize
$borderTopStyle
Border Top Style
protected
string
$borderTopStyle
$cellSpacing
protected
int|float
$cellSpacing
= null
$index
Index number in Style collection for named style
protected
int|null
$index
This number starts from one and defined in Style::setStyleValues()
$styleName
Style name
protected
string
$styleName
$alignment
private
string
$alignment
= ''
$bidiVisual
Visually Right to Left Table
private
bool
$bidiVisual
= false
Tags
$borderInsideHColor
Border color inside horizontal
private
string
$borderInsideHColor
$borderInsideHSize
Border size inside horizontal
private
int
$borderInsideHSize
$borderInsideVColor
Border color inside vertical
private
string
$borderInsideVColor
$borderInsideVSize
Border size inside vertical
private
int
$borderInsideVSize
$cellMarginBottom
Cell margin bottom
private
int
$cellMarginBottom
$cellMarginLeft
Cell margin left
private
int
$cellMarginLeft
$cellMarginRight
Cell margin right
private
int
$cellMarginRight
$cellMarginTop
Cell margin top
private
int
$cellMarginTop
$columnWidths
The width of each column, computed based on the max cell width of each column
private
array<string|int, int>
$columnWidths
$firstRowStyle
Style for first row
private
Table
$firstRowStyle
$indent
private
TblWidth|null
$indent
$isAuto
Is this an automatic style? (Used primarily in OpenDocument driver)
private
bool
$isAuto
= false
Tags
$isFirstRow
Is this a first row style?
private
bool
$isFirstRow
= false
$layout
private
string
$layout
= self::LAYOUT_AUTO
$position
Position
private
TablePosition
$position
$shading
Shading
private
Shading
$shading
$unit
private
string
$unit
= PhpOfficePhpWordSimpleTypeTblWidth::AUTO
$width
private
int|float
$width
= 0
Methods
__construct()
Create new table style
public
__construct([mixed $tableStyle = null ][, mixed $firstRowStyle = null ]) : mixed
Parameters
- $tableStyle : mixed = null
- $firstRowStyle : mixed = null
Return values
mixed —getAlign()
public
getAlign() : string
Tags
Return values
string —getAlignment()
public
getAlignment() : string
Tags
Return values
string —getBgColor()
Get background
public
getBgColor() : string
Return values
string —getBorderBottomColor()
Get border bottom color
public
getBorderBottomColor() : string
Return values
string —getBorderBottomSize()
Get border bottom size
public
getBorderBottomSize() : int|float
Return values
int|float —getBorderBottomStyle()
Get border bottom style
public
getBorderBottomStyle() : string
Return values
string —getBorderColor()
Get TLRBHV Border Color
public
getBorderColor() : array<string|int, string>
Return values
array<string|int, string> —getBorderInsideHColor()
Get border color inside horizontal
public
getBorderInsideHColor() : string
Return values
string —getBorderInsideHSize()
Get border size inside horizontal
public
getBorderInsideHSize() : int
Return values
int —getBorderInsideVColor()
Get border color inside vertical
public
getBorderInsideVColor() : string
Return values
string —getBorderInsideVSize()
Get border size inside vertical
public
getBorderInsideVSize() : int
Return values
int —getBorderLeftColor()
Get border left color
public
getBorderLeftColor() : string
Return values
string —getBorderLeftSize()
Get border left size
public
getBorderLeftSize() : int|float
Return values
int|float —getBorderLeftStyle()
Get border left style
public
getBorderLeftStyle() : string
Return values
string —getBorderRightColor()
Get border right color
public
getBorderRightColor() : string
Return values
string —getBorderRightSize()
Get border right size
public
getBorderRightSize() : int|float
Return values
int|float —getBorderRightStyle()
Get border right style
public
getBorderRightStyle() : string
Return values
string —getBorderSize()
Get TLRBHV Border Size
public
getBorderSize() : array<string|int, int>
Return values
array<string|int, int> —getBorderStyle()
Get border style
public
getBorderStyle() : array<string|int, string>
Return values
array<string|int, string> —getBorderTopColor()
Get border top color
public
getBorderTopColor() : string
Return values
string —getBorderTopSize()
Get border top size
public
getBorderTopSize() : int|float
Return values
int|float —getBorderTopStyle()
Get border top style
public
getBorderTopStyle() : string
Return values
string —getCellMargin()
Get cell margin
public
getCellMargin() : array<string|int, int>
Return values
array<string|int, int> —getCellMarginBottom()
Get cell margin bottom
public
getCellMarginBottom() : int
Return values
int —getCellMarginLeft()
Get cell margin left
public
getCellMarginLeft() : int
Return values
int —getCellMarginRight()
Get cell margin right
public
getCellMarginRight() : int
Return values
int —getCellMarginTop()
Get cell margin top
public
getCellMarginTop() : int
Return values
int —getCellSpacing()
public
getCellSpacing() : float|int
Return values
float|int —getChildStyleValue()
Return style value of child style object, e.g. `left` from `Indentation` child style of `Paragraph`
public
getChildStyleValue(AbstractStyle $substyleObject, string $substyleProperty) : mixed
Parameters
- $substyleObject : AbstractStyle
- $substyleProperty : string
Tags
Return values
mixed —getColumnWidths()
Get the columnWidths
public
getColumnWidths() : null|array<string|int, int>
Return values
null|array<string|int, int> —getFirstRow()
Set first row
public
getFirstRow() : Table
Return values
Table —getIndent()
public
getIndent() : TblWidth
Return values
TblWidth —getIndex()
Get index number
public
getIndex() : int|null
Return values
int|null —getLayout()
Get layout
public
getLayout() : string
Return values
string —getPosition()
Get position
public
getPosition() : TablePosition
Return values
TablePosition —getShading()
Get shading
public
getShading() : Shading
Return values
Shading —getStyleName()
Get style name
public
getStyleName() : string
Return values
string —getUnit()
Get width unit
public
getUnit() : string
Return values
string —getWidth()
Get width
public
getWidth() : int|float
Return values
int|float —hasBorder()
Check if any of the border is not null
public
hasBorder() : bool
Return values
bool —hasMargin()
Check if any of the margin is not null
public
hasMargin() : bool
Return values
bool —isAuto()
Get is automatic style flag
public
isAuto() : bool
Return values
bool —isBidiVisual()
Get bidiVisual
public
isBidiVisual() : bool
Return values
bool —setAlign()
public
setAlign([string $value = null ]) : self
Parameters
- $value : string = null
Tags
Return values
self —setAlignment()
public
setAlignment(string $value) : self
Parameters
- $value : string
Tags
Return values
self —setArrayStyle()
Set style using associative array
public
setArrayStyle([array<string|int, mixed> $style = array() ]) : self
Parameters
- $style : array<string|int, mixed> = array()
Tags
Return values
self —setAuto()
Set is automatic style flag
public
setAuto([bool $value = true ]) : self
Parameters
- $value : bool = true
Return values
self —setBgColor()
Set background
public
setBgColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBidiVisual()
Set bidiVisual
public
setBidiVisual(bool $bidi) : self
Parameters
- $bidi : bool
-
Set to true to visually present table as Right to Left
Return values
self —setBorderBottomColor()
Set border bottom color
public
setBorderBottomColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderBottomSize()
Set border bottom size
public
setBorderBottomSize([int|float $value = null ]) : self
Parameters
- $value : int|float = null
Return values
self —setBorderBottomStyle()
Set border bottom style
public
setBorderBottomStyle([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderColor()
Set TLRBHV Border Color
public
setBorderColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderInsideHColor()
Set border color inside horizontal
public
setBorderInsideHColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderInsideHSize()
Set border size inside horizontal
public
setBorderInsideHSize([int $value = null ]) : self
Parameters
- $value : int = null
Return values
self —setBorderInsideVColor()
Set border color inside vertical
public
setBorderInsideVColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderInsideVSize()
Set border size inside vertical
public
setBorderInsideVSize([int $value = null ]) : self
Parameters
- $value : int = null
Return values
self —setBorderLeftColor()
Set border left color
public
setBorderLeftColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderLeftSize()
Set border left size
public
setBorderLeftSize([int|float $value = null ]) : self
Parameters
- $value : int|float = null
Return values
self —setBorderLeftStyle()
Set border left style
public
setBorderLeftStyle([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderRightColor()
Set border right color
public
setBorderRightColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderRightSize()
Set border right size
public
setBorderRightSize([int|float $value = null ]) : self
Parameters
- $value : int|float = null
Return values
self —setBorderRightStyle()
Set border right style
public
setBorderRightStyle([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderSize()
Set TLRBHV Border Size
public
setBorderSize([int $value = null ]) : self
Parameters
- $value : int = null
-
Border size in eighths of a point (1/8 point)
Return values
self —setBorderStyle()
Set border style
public
setBorderStyle([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderTopColor()
Set border top color
public
setBorderTopColor([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setBorderTopSize()
Set border top size
public
setBorderTopSize([int|float $value = null ]) : self
Parameters
- $value : int|float = null
Return values
self —setBorderTopStyle()
Set border top Style
public
setBorderTopStyle([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setCellMargin()
Set TLRB cell margin
public
setCellMargin([int $value = null ]) : self
Parameters
- $value : int = null
-
Margin in twips
Return values
self —setCellMarginBottom()
Set cell margin bottom
public
setCellMarginBottom([int $value = null ]) : self
Parameters
- $value : int = null
Return values
self —setCellMarginLeft()
Set cell margin left
public
setCellMarginLeft([int $value = null ]) : self
Parameters
- $value : int = null
Return values
self —setCellMarginRight()
Set cell margin right
public
setCellMarginRight([int $value = null ]) : self
Parameters
- $value : int = null
Return values
self —setCellMarginTop()
Set cell margin top
public
setCellMarginTop([int $value = null ]) : self
Parameters
- $value : int = null
Return values
self —setCellSpacing()
public
setCellSpacing([float|int $cellSpacing = null ]) : mixed
Parameters
- $cellSpacing : float|int = null
Return values
mixed —setColumnWidths()
The column widths
public
setColumnWidths([array<string|int, int> $value = null ]) : mixed
Parameters
- $value : array<string|int, int> = null
Return values
mixed —setIndent()
public
setIndent(TblWidth $indent) : self
Parameters
- $indent : TblWidth
Tags
Return values
self —setIndex()
Set index number
public
setIndex([int|null $value = null ]) : self
Parameters
- $value : int|null = null
Return values
self —setLayout()
Set layout
public
setLayout([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setPosition()
Set position
public
setPosition([mixed $value = null ]) : self
Parameters
- $value : mixed = null
Return values
self —setShading()
Set shading
public
setShading([mixed $value = null ]) : self
Parameters
- $value : mixed = null
Return values
self —setStyleByArray()
Set style by using associative array
public
setStyleByArray([array<string|int, mixed> $values = array() ]) : self
Parameters
- $values : array<string|int, mixed> = array()
Return values
self —setStyleName()
Set style name
public
setStyleName(string $value) : self
Parameters
- $value : string
Return values
self —setStyleValue()
Set style value template method
public
setStyleValue(string $key, string $value) : self
Some child classes have their own specific overrides. Backward compability check for versions < 0.10.0 which use underscore prefix for their private properties. Check if the set method is exists. Throws an exception?
Parameters
- $key : string
- $value : string
Return values
self —setUnit()
Set width unit
public
setUnit([string $value = null ]) : self
Parameters
- $value : string = null
Return values
self —setWidth()
Set width
public
setWidth([int|float $value = null ]) : self
Parameters
- $value : int|float = null
Return values
self —setBoolVal()
Set bool value
protected
setBoolVal(bool $value, bool $default) : bool
Parameters
- $value : bool
- $default : bool
Return values
bool —setEnumVal()
Set enum value
protected
setEnumVal([mixed $value = null ][, array<string|int, mixed> $enum = array() ][, mixed $default = null ]) : mixed
Parameters
- $value : mixed = null
- $enum : array<string|int, mixed> = array()
- $default : mixed = null
Tags
Return values
mixed —setFloatVal()
Set float value: Convert string that contains only numeric into float
protected
setFloatVal(mixed $value[, float|null $default = null ]) : float|null
Parameters
- $value : mixed
- $default : float|null = null
Return values
float|null —setIntVal()
Set integer value: Convert string that contains only numeric into integer
protected
setIntVal(int|null $value[, int|null $default = null ]) : int|null
Parameters
- $value : int|null
- $default : int|null = null
Return values
int|null —setNonEmptyVal()
Set default for null and empty value
protected
setNonEmptyVal(string $value, string $default) : string
Parameters
- $value : string
-
(was: mixed)
- $default : string
-
(was: mixed)
Return values
string —(was: mixed)
setNumericVal()
Set numeric value
protected
setNumericVal(mixed $value[, int|float|null $default = null ]) : int|float|null
Parameters
- $value : mixed
- $default : int|float|null = null
Return values
int|float|null —setObjectVal()
Set object value
protected
setObjectVal(mixed $value, string $styleName, mixed &$style) : mixed
Parameters
- $value : mixed
- $styleName : string
- $style : mixed
Return values
mixed —setPairedVal()
Set $property value and set $pairProperty = false when $value = true
protected
setPairedVal(bool &$property, bool &$pairProperty, bool $value) : self
Parameters
- $property : bool
- $pairProperty : bool
- $value : bool
Return values
self —getTableOnlyProperty()
Get table style only property by checking if it's a firstRow
private
getTableOnlyProperty(string $property) : int|string|null
This is necessary since firstRow style is cloned from table style but without certain properties activated, e.g. margins
Parameters
- $property : string
Return values
int|string|null —setTableOnlyProperty()
Set table style only property by checking if it's a firstRow
private
setTableOnlyProperty(string $property, int|string $value[, bool $isNumeric = true ]) : self
This is necessary since firstRow style is cloned from table style but without certain properties activated, e.g. margins
Parameters
- $property : string
- $value : int|string
- $isNumeric : bool = true