\PhpOffice\PhpWord\StyleCell

Table cell style

Summary

Methods
Properties
Constants
getBorderSize()
setBorderSize()
getBorderColor()
setBorderColor()
getBorderStyle()
setBorderStyle()
getBorderTopSize()
setBorderTopSize()
getBorderTopColor()
setBorderTopColor()
getBorderTopStyle()
setBorderTopStyle()
getBorderLeftSize()
setBorderLeftSize()
getBorderLeftColor()
setBorderLeftColor()
getBorderLeftStyle()
setBorderLeftStyle()
getBorderRightSize()
setBorderRightSize()
getBorderRightColor()
setBorderRightColor()
getBorderRightStyle()
setBorderRightStyle()
getBorderBottomSize()
setBorderBottomSize()
getBorderBottomColor()
setBorderBottomColor()
getBorderBottomStyle()
setBorderBottomStyle()
hasBorder()
getStyleName()
setStyleName()
getIndex()
setIndex()
isAuto()
setAuto()
getChildStyleValue()
setStyleValue()
setStyleByArray()
setArrayStyle()
getVAlign()
setVAlign()
getTextDirection()
setTextDirection()
getBgColor()
setBgColor()
getGridSpan()
setGridSpan()
getVMerge()
setVMerge()
getShading()
setShading()
getWidth()
setWidth()
getUnit()
setUnit()
getDefaultBorderColor()
No public properties found
VALIGN_TOP
VALIGN_CENTER
VALIGN_BOTTOM
VALIGN_BOTH
TEXT_DIR_LRTB
TEXT_DIR_TBRL
TEXT_DIR_BTLR
TEXT_DIR_LRTBV
TEXT_DIR_TBRLV
TEXT_DIR_TBLRV
VMERGE_RESTART
VMERGE_CONTINUE
DEFAULT_BORDER_COLOR
setNonEmptyVal()
setBoolVal()
setNumericVal()
setIntVal()
setFloatVal()
setEnumVal()
setObjectVal()
setPairedVal()
$borderTopSize
$borderTopColor
$borderTopStyle
$borderLeftSize
$borderLeftColor
$borderLeftStyle
$borderRightSize
$borderRightColor
$borderRightStyle
$borderBottomSize
$borderBottomColor
$borderBottomStyle
$styleName
$index
$aliases
N/A
No private methods found
$isAuto
$vAlign
$textDirection
$gridSpan
$vMerge
$shading
$width
$unit
N/A

Constants

VALIGN_TOP

VALIGN_TOP = 'top'

Vertical alignment constants

VALIGN_CENTER

VALIGN_CENTER = 'center'

VALIGN_BOTTOM

VALIGN_BOTTOM = 'bottom'

VALIGN_BOTH

VALIGN_BOTH = 'both'

TEXT_DIR_LRTB

TEXT_DIR_LRTB = 'lrTb'

Left to Right, Top to Bottom

TEXT_DIR_TBRL

TEXT_DIR_TBRL = 'tbRl'

Top to Bottom, Right to Left

TEXT_DIR_BTLR

TEXT_DIR_BTLR = 'btLr'

Bottom to Top, Left to Right

TEXT_DIR_LRTBV

TEXT_DIR_LRTBV = 'lrTbV'

Left to Right, Top to Bottom Rotated

TEXT_DIR_TBRLV

TEXT_DIR_TBRLV = 'tbRlV'

Top to Bottom, Right to Left Rotated

TEXT_DIR_TBLRV

TEXT_DIR_TBLRV = 'tbLrV'

Top to Bottom, Left to Right Rotated

VMERGE_RESTART

VMERGE_RESTART = 'restart'

Vertical merge (rowspan) constants

VMERGE_CONTINUE

VMERGE_CONTINUE = 'continue'

DEFAULT_BORDER_COLOR

DEFAULT_BORDER_COLOR = '000000'

Default border color

Properties

$borderTopSize

$borderTopSize : integer|float

Border Top Size

Type

integer|float

$borderTopColor

$borderTopColor : string

Border Top Color

Type

string

$borderTopStyle

$borderTopStyle : string

Border Top Style

Type

string

$borderLeftSize

$borderLeftSize : integer|float

Border Left Size

Type

integer|float

$borderLeftColor

$borderLeftColor : string

Border Left Color

Type

string

$borderLeftStyle

$borderLeftStyle : string

Border Left Style

Type

string

$borderRightSize

$borderRightSize : integer|float

Border Right Size

Type

integer|float

$borderRightColor

$borderRightColor : string

Border Right Color

Type

string

$borderRightStyle

$borderRightStyle : string

Border Right Style

Type

string

$borderBottomSize

$borderBottomSize : integer|float

Border Bottom Size

Type

integer|float

$borderBottomColor

$borderBottomColor : string

Border Bottom Color

Type

string

$borderBottomStyle

$borderBottomStyle : string

Border Bottom Style

Type

string

$styleName

$styleName : string

Style name

Type

string

$index

$index : integer|null

Index number in Style collection for named style

This number starts from one and defined in Style::setStyleValues()

Type

integer|null

$aliases

$aliases : array

Aliases

Type

array

$isAuto

$isAuto : boolean

Is this an automatic style? (Used primarily in OpenDocument driver)

Type

boolean

$vAlign

$vAlign : string

Vertical align (top, center, both, bottom)

Type

string

$textDirection

$textDirection : string

Text Direction

Type

string

$gridSpan

$gridSpan : integer

colspan

Type

integer

$vMerge

$vMerge : string

rowspan (restart, continue)

  • restart: Start/restart merged region
  • continue: Continue merged region

Type

string

$width

$width : integer

Width

Type

integer

$unit

$unit : string

Width unit

Type

string

Methods

getBorderSize()

getBorderSize() : array<mixed,integer>

Get border size

Returns

array<mixed,integer>

setBorderSize()

setBorderSize(integer|float  $value = null) : self

Set border size

Parameters

integer|float $value

Returns

self

getBorderColor()

getBorderColor() : array<mixed,string>

Get border color

Returns

array<mixed,string>

setBorderColor()

setBorderColor(string  $value = null) : self

Set border color

Parameters

string $value

Returns

self

getBorderStyle()

getBorderStyle() : array<mixed,string>

Get border style

Returns

array<mixed,string>

setBorderStyle()

setBorderStyle(string  $value = null) : self

Set border style

Parameters

string $value

Returns

self

getBorderTopSize()

getBorderTopSize() : integer|float

Get border top size

Returns

integer|float

setBorderTopSize()

setBorderTopSize(integer|float  $value = null) : self

Set border top size

Parameters

integer|float $value

Returns

self

getBorderTopColor()

getBorderTopColor() : string

Get border top color

Returns

string

setBorderTopColor()

setBorderTopColor(string  $value = null) : self

Set border top color

Parameters

string $value

Returns

self

getBorderTopStyle()

getBorderTopStyle() : string

Get border top style

Returns

string

setBorderTopStyle()

setBorderTopStyle(string  $value = null) : self

Set border top Style

Parameters

string $value

Returns

self

getBorderLeftSize()

getBorderLeftSize() : integer|float

Get border left size

Returns

integer|float

setBorderLeftSize()

setBorderLeftSize(integer|float  $value = null) : self

Set border left size

Parameters

integer|float $value

Returns

self

getBorderLeftColor()

getBorderLeftColor() : string

Get border left color

Returns

string

setBorderLeftColor()

setBorderLeftColor(string  $value = null) : self

Set border left color

Parameters

string $value

Returns

self

getBorderLeftStyle()

getBorderLeftStyle() : string

Get border left style

Returns

string

setBorderLeftStyle()

setBorderLeftStyle(string  $value = null) : self

Set border left style

Parameters

string $value

Returns

self

getBorderRightSize()

getBorderRightSize() : integer|float

Get border right size

Returns

integer|float

setBorderRightSize()

setBorderRightSize(integer|float  $value = null) : self

Set border right size

Parameters

integer|float $value

Returns

self

getBorderRightColor()

getBorderRightColor() : string

Get border right color

Returns

string

setBorderRightColor()

setBorderRightColor(string  $value = null) : self

Set border right color

Parameters

string $value

Returns

self

getBorderRightStyle()

getBorderRightStyle() : string

Get border right style

Returns

string

setBorderRightStyle()

setBorderRightStyle(string  $value = null) : self

Set border right style

Parameters

string $value

Returns

self

getBorderBottomSize()

getBorderBottomSize() : integer|float

Get border bottom size

Returns

integer|float

setBorderBottomSize()

setBorderBottomSize(integer|float  $value = null) : self

Set border bottom size

Parameters

integer|float $value

Returns

self

getBorderBottomColor()

getBorderBottomColor() : string

Get border bottom color

Returns

string

setBorderBottomColor()

setBorderBottomColor(string  $value = null) : self

Set border bottom color

Parameters

string $value

Returns

self

getBorderBottomStyle()

getBorderBottomStyle() : string

Get border bottom style

Returns

string

setBorderBottomStyle()

setBorderBottomStyle(string  $value = null) : self

Set border bottom style

Parameters

string $value

Returns

self

hasBorder()

hasBorder() : boolean

Check if any of the border is not null

Returns

boolean

getStyleName()

getStyleName() : string

Get style name

Returns

string

setStyleName()

setStyleName(string  $value) : self

Set style name

Parameters

string $value

Returns

self

getIndex()

getIndex() : integer|null

Get index number

Returns

integer|null

setIndex()

setIndex(integer|null  $value = null) : self

Set index number

Parameters

integer|null $value

Returns

self

isAuto()

isAuto() : boolean

Get is automatic style flag

Returns

boolean

setAuto()

setAuto(boolean  $value = true) : self

Set is automatic style flag

Parameters

boolean $value

Returns

self

getChildStyleValue()

getChildStyleValue(\PhpOffice\PhpWord\Style\AbstractStyle  $substyleObject, string  $substyleProperty) : mixed

Return style value of child style object, e.g. `left` from `Indentation` child style of `Paragraph`

Parameters

\PhpOffice\PhpWord\Style\AbstractStyle $substyleObject
string $substyleProperty

Returns

mixed

setStyleValue()

setStyleValue(string  $key, string  $value) : self

Set style value template method

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

string $key
string $value

Returns

self

setStyleByArray()

setStyleByArray(array  $values = array()) : self

Set style by using associative array

Parameters

array $values

Returns

self

setArrayStyle()

setArrayStyle(array  $style = array()) : self

Set style using associative array

Parameters

array $style

Returns

self

getVAlign()

getVAlign() : string

Get vertical align.

Returns

string

setVAlign()

setVAlign(string  $value = null) : self

Set vertical align

Parameters

string $value

Returns

self

getTextDirection()

getTextDirection() : string

Get text direction.

Returns

string

setTextDirection()

setTextDirection(string  $value = null) : self

Set text direction

Parameters

string $value

Returns

self

getBgColor()

getBgColor() : string

Get background

Returns

string

setBgColor()

setBgColor(string  $value = null) : self

Set background

Parameters

string $value

Returns

self

getGridSpan()

getGridSpan() : integer

Get grid span (colspan).

Returns

integer

setGridSpan()

setGridSpan(integer  $value = null) : self

Set grid span (colspan)

Parameters

integer $value

Returns

self

getVMerge()

getVMerge() : string

Get vertical merge (rowspan).

Returns

string

setVMerge()

setVMerge(string  $value = null) : self

Set vertical merge (rowspan)

Parameters

string $value

Returns

self

setShading()

setShading(mixed  $value = null) : self

Set shading

Parameters

mixed $value

Returns

self

getWidth()

getWidth() : integer

Get cell width

Returns

integer

setWidth()

setWidth(integer  $value) : self

Set cell width

Parameters

integer $value

Returns

self

getUnit()

getUnit() : string

Get width unit

Returns

string

setUnit()

setUnit(string  $value) 

Set width unit

Parameters

string $value

getDefaultBorderColor()

getDefaultBorderColor() 

Get default border color

setNonEmptyVal()

setNonEmptyVal(string  $value, string  $default) : string

Set default for null and empty value

Parameters

string $value

(was: mixed)

string $default

(was: mixed)

Returns

string —

(was: mixed)

setBoolVal()

setBoolVal(boolean  $value, boolean  $default) : boolean

Set bool value

Parameters

boolean $value
boolean $default

Returns

boolean

setNumericVal()

setNumericVal(mixed  $value, integer|float|null  $default = null) : integer|float|null

Set numeric value

Parameters

mixed $value
integer|float|null $default

Returns

integer|float|null

setIntVal()

setIntVal(integer|null  $value, integer|null  $default = null) : integer|null

Set integer value: Convert string that contains only numeric into integer

Parameters

integer|null $value
integer|null $default

Returns

integer|null

setFloatVal()

setFloatVal(mixed  $value, float|null  $default = null) : float|null

Set float value: Convert string that contains only numeric into float

Parameters

mixed $value
float|null $default

Returns

float|null

setEnumVal()

setEnumVal(mixed  $value = null, array  $enum = array(), mixed  $default = null) : mixed

Set enum value

Parameters

mixed $value
array $enum
mixed $default

Throws

\InvalidArgumentException

Returns

mixed

setObjectVal()

setObjectVal(mixed  $value, string  $styleName,   $style) : mixed

Set object value

Parameters

mixed $value
string $styleName
$style

Returns

mixed

setPairedVal()

setPairedVal(  $property,   $pairProperty, boolean  $value) : self

Set $property value and set $pairProperty = false when $value = true

Parameters

$property
$pairProperty
boolean $value

Returns

self