Constants

EN_US

EN_US = 'en-US'

EN_US_ID

EN_US_ID = 1033

EN_GB

EN_GB = 'en-GB'

EN_GB_ID

EN_GB_ID = 2057

FR_FR

FR_FR = 'fr-FR'

FR_FR_ID

FR_FR_ID = 1036

FR_BE

FR_BE = 'fr-BE'

FR_BE_ID

FR_BE_ID = 2060

ES_ES

ES_ES = 'es-ES'

ES_ES_ID

ES_ES_ID = 3082

DE_DE

DE_DE = 'de-DE'

DE_DE_ID

DE_DE_ID = 1031

HE_IL

HE_IL = 'he-IL'

HE_IL_ID

HE_IL_ID = 1037

IT_IT

IT_IT = 'it-IT'

IT_IT_ID

IT_IT_ID = 1040

JA_JP

JA_JP = 'ja-JP'

JA_JP_ID

JA_JP_ID = 1041

KO_KR

KO_KR = 'ko-KR'

KO_KR_ID

KO_KR_ID = 1042

ZH_CN

ZH_CN = 'zh-CN'

ZH_CN_ID

ZH_CN_ID = 2052

HI_IN

HI_IN = 'hi-IN'

HI_IN_ID

HI_IN_ID = 1081

PT_BR

PT_BR = 'pt-BR'

PT_BR_ID

PT_BR_ID = 1046

Properties

$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

$langId

$langId : integer

Language ID, used for RTF document generation

Type

integer

$latin

$latin : string

Latin Language

Type

string

$eastAsia

$eastAsia : string

East Asian Language

Type

string

$bidirectional

$bidirectional : string

Complex Script Language

Type

string

Methods

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

__construct()

__construct(string|null  $latin = null, string|null  $eastAsia = null, string|null  $bidirectional = null) 

Constructor

Parameters

string|null $latin
string|null $eastAsia
string|null $bidirectional

setLatin()

setLatin(string  $latin) : self

Set the Latin Language

Parameters

string $latin

The value for the latin language

Returns

self

getLatin()

getLatin() : string|null

Get the Latin Language

Returns

string|null

setLangId()

setLangId(integer  $langId) : self

Set the Language ID

Parameters

integer $langId

The value for the language ID

Returns

self

getLangId()

getLangId() : integer

Get the Language ID

Returns

integer

setEastAsia()

setEastAsia(string  $eastAsia) : self

Set the East Asian Language

Parameters

string $eastAsia

The value for the east asian language

Returns

self

getEastAsia()

getEastAsia() : string|null

Get the East Asian Language

Returns

string|null

setBidirectional()

setBidirectional(string  $bidirectional) : self

Set the Complex Script Language

Parameters

string $bidirectional

The value for the complex script language

Returns

self

getBidirectional()

getBidirectional() : string|null

Get the Complex Script Language

Returns

string|null

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

validateLocale()

validateLocale(string  $locale) : string

Validates that the language passed is in the format xx-xx

Parameters

string $locale

Returns

string