\PhpOffice\PhpWord\StyleFont

Font style

Summary

Methods
Properties
Constants
getStyleName()
setStyleName()
getIndex()
setIndex()
isAuto()
setAuto()
getChildStyleValue()
setStyleValue()
setStyleByArray()
setArrayStyle()
__construct()
getStyleValues()
getStyleType()
getName()
setName()
getHint()
setHint()
getSize()
setSize()
getColor()
setColor()
isBold()
setBold()
isItalic()
setItalic()
getUnderline()
setUnderline()
isSuperScript()
setSuperScript()
isSubScript()
setSubScript()
isStrikethrough()
setStrikethrough()
isDoubleStrikethrough()
setDoubleStrikethrough()
isSmallCaps()
setSmallCaps()
isAllCaps()
setAllCaps()
getFgColor()
setFgColor()
getBgColor()
setBgColor()
getScale()
setScale()
getSpacing()
setSpacing()
getKerning()
setKerning()
isNoProof()
setNoProof()
getLineHeight()
setLineHeight()
getParagraph()
setParagraph()
isRTL()
setRTL()
getShading()
setShading()
getLang()
setLang()
getBold()
getItalic()
getSuperScript()
getSubScript()
getStrikethrough()
getParagraphStyle()
getPosition()
setPosition()
No public properties found
UNDERLINE_NONE
UNDERLINE_DASH
UNDERLINE_DASHHEAVY
UNDERLINE_DASHLONG
UNDERLINE_DASHLONGHEAVY
UNDERLINE_DOUBLE
UNDERLINE_DOTHASH
UNDERLINE_DOTHASHHEAVY
UNDERLINE_DOTDASH
UNDERLINE_DOTDASHHEAVY
UNDERLINE_DOTDOTDASH
UNDERLINE_DOTDOTDASHHEAVY
UNDERLINE_DOTTED
UNDERLINE_DOTTEDHEAVY
UNDERLINE_HEAVY
UNDERLINE_SINGLE
UNDERLINE_WAVY
UNDERLINE_WAVYDOUBLE
UNDERLINE_WAVYHEAVY
UNDERLINE_WORDS
FGCOLOR_YELLOW
FGCOLOR_LIGHTGREEN
FGCOLOR_CYAN
FGCOLOR_MAGENTA
FGCOLOR_BLUE
FGCOLOR_RED
FGCOLOR_DARKBLUE
FGCOLOR_DARKCYAN
FGCOLOR_DARKGREEN
FGCOLOR_DARKMAGENTA
FGCOLOR_DARKRED
FGCOLOR_DARKYELLOW
FGCOLOR_DARKGRAY
FGCOLOR_LIGHTGRAY
FGCOLOR_BLACK
setNonEmptyVal()
setBoolVal()
setNumericVal()
setIntVal()
setFloatVal()
setEnumVal()
setObjectVal()
setPairedVal()
$styleName
$index
$aliases
N/A
No private methods found
$isAuto
$type
$name
$hint
$size
$color
$bold
$italic
$underline
$superScript
$subScript
$strikethrough
$doubleStrikethrough
$smallCaps
$allCaps
$fgColor
$scale
$spacing
$kerning
$paragraph
$shading
$rtl
$noProof
$lang
$position
N/A

Constants

UNDERLINE_NONE

UNDERLINE_NONE = 'none'

Underline types

UNDERLINE_DASH

UNDERLINE_DASH = 'dash'

UNDERLINE_DASHHEAVY

UNDERLINE_DASHHEAVY = 'dashHeavy'

UNDERLINE_DASHLONG

UNDERLINE_DASHLONG = 'dashLong'

UNDERLINE_DASHLONGHEAVY

UNDERLINE_DASHLONGHEAVY = 'dashLongHeavy'

UNDERLINE_DOUBLE

UNDERLINE_DOUBLE = 'dbl'

UNDERLINE_DOTHASH

UNDERLINE_DOTHASH = 'dotDash'

UNDERLINE_DOTHASHHEAVY

UNDERLINE_DOTHASHHEAVY = 'dotDashHeavy'

UNDERLINE_DOTDASH

UNDERLINE_DOTDASH = 'dotDash'

UNDERLINE_DOTDASHHEAVY

UNDERLINE_DOTDASHHEAVY = 'dotDashHeavy'

UNDERLINE_DOTDOTDASH

UNDERLINE_DOTDOTDASH = 'dotDotDash'

UNDERLINE_DOTDOTDASHHEAVY

UNDERLINE_DOTDOTDASHHEAVY = 'dotDotDashHeavy'

UNDERLINE_DOTTED

UNDERLINE_DOTTED = 'dotted'

UNDERLINE_DOTTEDHEAVY

UNDERLINE_DOTTEDHEAVY = 'dottedHeavy'

UNDERLINE_HEAVY

UNDERLINE_HEAVY = 'heavy'

UNDERLINE_SINGLE

UNDERLINE_SINGLE = 'single'

UNDERLINE_WAVY

UNDERLINE_WAVY = 'wavy'

UNDERLINE_WAVYDOUBLE

UNDERLINE_WAVYDOUBLE = 'wavyDbl'

UNDERLINE_WAVYHEAVY

UNDERLINE_WAVYHEAVY = 'wavyHeavy'

UNDERLINE_WORDS

UNDERLINE_WORDS = 'words'

FGCOLOR_YELLOW

FGCOLOR_YELLOW = 'yellow'

Foreground colors

FGCOLOR_LIGHTGREEN

FGCOLOR_LIGHTGREEN = 'green'

FGCOLOR_CYAN

FGCOLOR_CYAN = 'cyan'

FGCOLOR_MAGENTA

FGCOLOR_MAGENTA = 'magenta'

FGCOLOR_BLUE

FGCOLOR_BLUE = 'blue'

FGCOLOR_RED

FGCOLOR_RED = 'red'

FGCOLOR_DARKBLUE

FGCOLOR_DARKBLUE = 'darkBlue'

FGCOLOR_DARKCYAN

FGCOLOR_DARKCYAN = 'darkCyan'

FGCOLOR_DARKGREEN

FGCOLOR_DARKGREEN = 'darkGreen'

FGCOLOR_DARKMAGENTA

FGCOLOR_DARKMAGENTA = 'darkMagenta'

FGCOLOR_DARKRED

FGCOLOR_DARKRED = 'darkRed'

FGCOLOR_DARKYELLOW

FGCOLOR_DARKYELLOW = 'darkYellow'

FGCOLOR_DARKGRAY

FGCOLOR_DARKGRAY = 'darkGray'

FGCOLOR_LIGHTGRAY

FGCOLOR_LIGHTGRAY = 'lightGray'

FGCOLOR_BLACK

FGCOLOR_BLACK = 'black'

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

$type

$type : string

Font style type

Type

string

$name

$name : string

Font name

Type

string

$hint

$hint : string

Font Content Type

Type

string

$size

$size : integer|float

Font size

Type

integer|float

$color

$color : string

Font color

Type

string

$bold

$bold : boolean

Bold

Type

boolean

$italic

$italic : boolean

Italic

Type

boolean

$underline

$underline : string

Undeline

Type

string

$superScript

$superScript : boolean

Superscript

Type

boolean

$subScript

$subScript : boolean

Subscript

Type

boolean

$strikethrough

$strikethrough : boolean

Strikethrough

Type

boolean

$doubleStrikethrough

$doubleStrikethrough : boolean

Double strikethrough

Type

boolean

$smallCaps

$smallCaps : boolean

Small caps

Type

boolean

$allCaps

$allCaps : boolean

All caps

Type

boolean

$fgColor

$fgColor : string

Foreground/highlight

Type

string

$scale

$scale : integer

Expanded/compressed text: 0-600 (percent)

Type

integer

$spacing

$spacing : integer|float

Character spacing adjustment: twip

Type

integer|float

$kerning

$kerning : integer|float

Font kerning: halfpoint

Type

integer|float

$rtl

$rtl : boolean

Right to left languages

Type

boolean

$noProof

$noProof : boolean

noProof (disables AutoCorrect)

Type

boolean — http://www.datypic.com/sc/ooxml/e-w_noProof-1.html

$position

$position : integer

Vertically Raised or Lowered Text

Type

integer — Signed Half-Point Measurement

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  $type = 'text', array|string|\PhpOffice\PhpWord\Style\AbstractStyle  $paragraph = null) 

Create new font style

Parameters

string $type

Type of font

array|string|\PhpOffice\PhpWord\Style\AbstractStyle $paragraph

Paragraph styles definition

getStyleValues()

getStyleValues() : array

Get style values

Returns

array

getStyleType()

getStyleType() : string

Get style type

Returns

string

getName()

getName() : string

Get font name

Returns

string

setName()

setName(string  $value = null) : self

Set font name

Parameters

string $value

Returns

self

getHint()

getHint() : string

Get Font Content Type

Returns

string

setHint()

setHint(string  $value = null) : self

Set Font Content Type

Parameters

string $value

Returns

self

getSize()

getSize() : integer|float

Get font size

Returns

integer|float

setSize()

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

Set font size

Parameters

integer|float $value

Returns

self

getColor()

getColor() : string

Get font color

Returns

string

setColor()

setColor(string  $value = null) : self

Set font color

Parameters

string $value

Returns

self

isBold()

isBold() : boolean

Get bold

Returns

boolean

setBold()

setBold(boolean  $value = true) : self

Set bold

Parameters

boolean $value

Returns

self

isItalic()

isItalic() : boolean

Get italic

Returns

boolean

setItalic()

setItalic(boolean  $value = true) : self

Set italic

Parameters

boolean $value

Returns

self

getUnderline()

getUnderline() : string

Get underline

Returns

string

setUnderline()

setUnderline(string  $value = self::UNDERLINE_NONE) : self

Set underline

Parameters

string $value

Returns

self

isSuperScript()

isSuperScript() : boolean

Get superscript

Returns

boolean

setSuperScript()

setSuperScript(boolean  $value = true) : self

Set superscript

Parameters

boolean $value

Returns

self

isSubScript()

isSubScript() : boolean

Get subscript

Returns

boolean

setSubScript()

setSubScript(boolean  $value = true) : self

Set subscript

Parameters

boolean $value

Returns

self

isStrikethrough()

isStrikethrough() : boolean

Get strikethrough

Returns

boolean

setStrikethrough()

setStrikethrough(boolean  $value = true) : self

Set strikethrough

Parameters

boolean $value

Returns

self

isDoubleStrikethrough()

isDoubleStrikethrough() : boolean

Get double strikethrough

Returns

boolean

setDoubleStrikethrough()

setDoubleStrikethrough(boolean  $value = true) : self

Set double strikethrough

Parameters

boolean $value

Returns

self

isSmallCaps()

isSmallCaps() : boolean

Get small caps

Returns

boolean

setSmallCaps()

setSmallCaps(boolean  $value = true) : self

Set small caps

Parameters

boolean $value

Returns

self

isAllCaps()

isAllCaps() : boolean

Get all caps

Returns

boolean

setAllCaps()

setAllCaps(boolean  $value = true) : self

Set all caps

Parameters

boolean $value

Returns

self

getFgColor()

getFgColor() : string

Get foreground/highlight color

Returns

string

setFgColor()

setFgColor(string  $value = null) : self

Set foreground/highlight color

Parameters

string $value

Returns

self

getBgColor()

getBgColor() : string

Get background

Returns

string

setBgColor()

setBgColor(string  $value = null) : \PhpOffice\PhpWord\Style\Table

Set background

Parameters

string $value

Returns

\PhpOffice\PhpWord\Style\Table

getScale()

getScale() : integer

Get scale

Returns

integer

setScale()

setScale(integer  $value = null) : self

Set scale

Parameters

integer $value

Returns

self

getSpacing()

getSpacing() : integer|float

Get font spacing

Returns

integer|float

setSpacing()

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

Set font spacing

Parameters

integer|float $value

Returns

self

getKerning()

getKerning() : integer|float

Get font kerning

Returns

integer|float

setKerning()

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

Set font kerning

Parameters

integer|float $value

Returns

self

isNoProof()

isNoProof() : boolean

Get noProof (disables autocorrect)

Returns

boolean

setNoProof()

setNoProof(boolean  $value = false) : $this

Set noProof (disables autocorrect)

Parameters

boolean $value

Returns

$this

getLineHeight()

getLineHeight() : integer|float

Get line height

Returns

integer|float

setLineHeight()

setLineHeight(integer|float|string  $value) : self

Set lineheight

Parameters

integer|float|string $value

Returns

self

setParagraph()

setParagraph(mixed  $value = null) : self

Set Paragraph

Parameters

mixed $value

Returns

self

isRTL()

isRTL() : boolean

Get rtl

Returns

boolean

setRTL()

setRTL(boolean  $value = true) : self

Set rtl

Parameters

boolean $value

Returns

self

setShading()

setShading(mixed  $value = null) : self

Set shading

Parameters

mixed $value

Returns

self

setLang()

setLang(mixed  $value = null) : self

Set language

Parameters

mixed $value

Returns

self

getBold()

getBold() 

Get bold

getItalic()

getItalic() 

Get italic

getSuperScript()

getSuperScript() 

Get superscript

getSubScript()

getSubScript() 

Get subscript

getStrikethrough()

getStrikethrough() 

Get strikethrough

getParagraphStyle()

getParagraphStyle() 

Get paragraph style

getPosition()

getPosition() : integer

Get position

Returns

integer

setPosition()

setPosition(integer  $value = null) : self

Set position

Parameters

integer $value

Returns

self

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