Font extends Supervisor
Table of Contents
- UNDERLINE_DOUBLE = 'double'
- UNDERLINE_DOUBLEACCOUNTING = 'doubleAccounting'
- UNDERLINE_NONE = 'none'
- UNDERLINE_SINGLE = 'single'
- UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'
- $colorIndex : null|int
- $bold : null|bool
- Bold.
- $color : Color
- Foreground color.
- $isSupervisor : bool
- Supervisor?
- $italic : null|bool
- Italic.
- $name : null|string
- Font Name.
- $parent : Spreadsheet|Supervisor
- Parent. Only used for supervisor.
- $parentPropertyName : null|string
- Parent property name.
- $scheme : string
- $size : null|float
- Font Size.
- $strikethrough : null|bool
- Strikethrough.
- $subscript : null|bool
- Subscript.
- $superscript : null|bool
- Superscript.
- $underline : null|string
- Underline.
- $baseLine : int
- $chartColor : ChartColor|null
- $complexScript : string
- $eastAsian : string
- $latin : string
- The following 7 are used only for chart titles, I think.
- $strikeType : string
- $underlineColor : ChartColor|null
- __clone() : mixed
- Implement PHP __clone to create a deep clone, not just a shallow copy.
- __construct() : mixed
- Create a new Font.
- applyFromArray() : $this
- Apply styles from array.
- bindParent() : $this
- Bind parent. Only used for supervisor.
- exportArray() : array<string|int, mixed>
- Export style as array.
- getActiveCell() : string
- Get the currently active cell coordinate in currently active sheet.
- getActiveSheet() : Worksheet
- Get the currently active sheet. Only used for supervisor.
- getBaseLine() : int
- getBold() : null|bool
- Get Bold.
- getChartColor() : ChartColor|null
- getColor() : Color
- Get Color.
- getComplexScript() : string
- getEastAsian() : string
- getHashCode() : string
- Get hash code.
- getIsSupervisor() : bool
- Is this a supervisor or a cell style component?
- getItalic() : null|bool
- Get Italic.
- getLatin() : string
- getName() : null|string
- Get Name.
- getScheme() : string
- getSelectedCells() : string
- Get the currently active cell coordinate in currently active sheet.
- getSharedComponent() : Font
- Get the shared style component for the currently active cell in currently active sheet.
- getSize() : null|float
- Get Size.
- getStrikethrough() : null|bool
- Get Strikethrough.
- getStrikeType() : string
- getStyleArray() : array<string|int, mixed>
- Build style array from subcomponents.
- getSubscript() : null|bool
- Get Subscript.
- getSuperscript() : null|bool
- Get Superscript.
- getUnderline() : null|string
- Get Underline.
- getUnderlineColor() : ChartColor|null
- setBaseLine() : self
- setBold() : $this
- Set Bold.
- setChartColor() : self
- setChartColorFromObject() : self
- setColor() : $this
- Set Color.
- setComplexScript() : self
- setEastAsian() : self
- setItalic() : $this
- Set Italic.
- setLatin() : self
- setName() : self
- Set Name and turn off Scheme.
- setScheme() : self
- setSize() : $this
- Set Size.
- setStrikethrough() : $this
- Set Strikethrough.
- setStrikeType() : self
- setSubscript() : $this
- Set Subscript.
- setSuperscript() : $this
- Set Superscript.
- setUnderline() : $this
- Set Underline.
- setUnderlineColor() : self
- exportArray1() : array<string|int, mixed>
- Abstract method to be implemented in anything which extends this class.
- exportArray2() : void
- Populate array from exportArray1.
- hashChartColor() : string
Constants
UNDERLINE_DOUBLE
public
mixed
UNDERLINE_DOUBLE
= 'double'
UNDERLINE_DOUBLEACCOUNTING
public
mixed
UNDERLINE_DOUBLEACCOUNTING
= 'doubleAccounting'
UNDERLINE_NONE
public
mixed
UNDERLINE_NONE
= 'none'
UNDERLINE_SINGLE
public
mixed
UNDERLINE_SINGLE
= 'single'
UNDERLINE_SINGLEACCOUNTING
public
mixed
UNDERLINE_SINGLEACCOUNTING
= 'singleAccounting'
Properties
$colorIndex
public
null|int
$colorIndex
$bold
Bold.
protected
null|bool
$bold
= false
$color
Foreground color.
protected
Color
$color
$isSupervisor
Supervisor?
protected
bool
$isSupervisor
$italic
Italic.
protected
null|bool
$italic
= false
$name
Font Name.
protected
null|string
$name
= 'Calibri'
$parent
Parent. Only used for supervisor.
protected
Spreadsheet|Supervisor
$parent
$parentPropertyName
Parent property name.
protected
null|string
$parentPropertyName
$scheme
protected
string
$scheme
= ''
$size
Font Size.
protected
null|float
$size
= 11
$strikethrough
Strikethrough.
protected
null|bool
$strikethrough
= false
$subscript
Subscript.
protected
null|bool
$subscript
= false
$superscript
Superscript.
protected
null|bool
$superscript
= false
$underline
Underline.
protected
null|string
$underline
= self::UNDERLINE_NONE
$baseLine
private
int
$baseLine
= 0
$chartColor
private
ChartColor|null
$chartColor
$complexScript
private
string
$complexScript
= ''
$eastAsian
private
string
$eastAsian
= ''
$latin
The following 7 are used only for chart titles, I think.
private
string
$latin
= ''
$strikeType
private
string
$strikeType
= ''
$underlineColor
private
ChartColor|null
$underlineColor
Methods
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
public
__clone() : mixed
Return values
mixed —__construct()
Create a new Font.
public
__construct([bool $isSupervisor = false ][, bool $isConditional = false ]) : mixed
Parameters
- $isSupervisor : bool = false
-
Flag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are
- $isConditional : bool = false
-
Flag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are
Return values
mixed —applyFromArray()
Apply styles from array.
public
applyFromArray(array<string|int, mixed> $styleArray) : $this
$spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray(
[
'name' => 'Arial',
'bold' => TRUE,
'italic' => FALSE,
'underline' => \PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE,
'strikethrough' => FALSE,
'color' => [
'rgb' => '808080'
]
]
);
Parameters
- $styleArray : array<string|int, mixed>
-
Array containing style information
Return values
$this —bindParent()
Bind parent. Only used for supervisor.
public
bindParent(Spreadsheet|Supervisor $parent[, null|string $parentPropertyName = null ]) : $this
Parameters
- $parent : Spreadsheet|Supervisor
- $parentPropertyName : null|string = null
Return values
$this —exportArray()
Export style as array.
public
final exportArray() : array<string|int, mixed>
Available to anything which extends this class: Alignment, Border, Borders, Color, Fill, Font, NumberFormat, Protection, and Style.
Return values
array<string|int, mixed> —getActiveCell()
Get the currently active cell coordinate in currently active sheet.
public
getActiveCell() : string
Only used for supervisor.
Return values
string —E.g. 'A1'
getActiveSheet()
Get the currently active sheet. Only used for supervisor.
public
getActiveSheet() : Worksheet
Return values
Worksheet —getBaseLine()
public
getBaseLine() : int
Return values
int —getBold()
Get Bold.
public
getBold() : null|bool
Return values
null|bool —getChartColor()
public
getChartColor() : ChartColor|null
Return values
ChartColor|null —getColor()
Get Color.
public
getColor() : Color
Return values
Color —getComplexScript()
public
getComplexScript() : string
Return values
string —getEastAsian()
public
getEastAsian() : string
Return values
string —getHashCode()
Get hash code.
public
getHashCode() : string
Return values
string —Hash code
getIsSupervisor()
Is this a supervisor or a cell style component?
public
getIsSupervisor() : bool
Return values
bool —getItalic()
Get Italic.
public
getItalic() : null|bool
Return values
null|bool —getLatin()
public
getLatin() : string
Return values
string —getName()
Get Name.
public
getName() : null|string
Return values
null|string —getScheme()
public
getScheme() : string
Return values
string —getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
public
getSelectedCells() : string
Only used for supervisor.
Return values
string —E.g. 'A1'
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
public
getSharedComponent() : Font
Only used for style supervisor.
Return values
Font —getSize()
Get Size.
public
getSize() : null|float
Return values
null|float —getStrikethrough()
Get Strikethrough.
public
getStrikethrough() : null|bool
Return values
null|bool —getStrikeType()
public
getStrikeType() : string
Return values
string —getStyleArray()
Build style array from subcomponents.
public
getStyleArray(array<string|int, mixed> $array) : array<string|int, mixed>
Parameters
- $array : array<string|int, mixed>
Return values
array<string|int, mixed> —getSubscript()
Get Subscript.
public
getSubscript() : null|bool
Return values
null|bool —getSuperscript()
Get Superscript.
public
getSuperscript() : null|bool
Return values
null|bool —getUnderline()
Get Underline.
public
getUnderline() : null|string
Return values
null|string —getUnderlineColor()
public
getUnderlineColor() : ChartColor|null
Return values
ChartColor|null —setBaseLine()
public
setBaseLine(int $baseLine) : self
Parameters
- $baseLine : int
Return values
self —setBold()
Set Bold.
public
setBold(bool $bold) : $this
Parameters
- $bold : bool
Return values
$this —setChartColor()
public
setChartColor(array<string|int, mixed> $colorArray) : self
Parameters
- $colorArray : array<string|int, mixed>
Return values
self —setChartColorFromObject()
public
setChartColorFromObject(ChartColor|null $chartColor) : self
Parameters
- $chartColor : ChartColor|null
Return values
self —setColor()
Set Color.
public
setColor(Color $color) : $this
Parameters
- $color : Color
Return values
$this —setComplexScript()
public
setComplexScript(string $fontname) : self
Parameters
- $fontname : string
Return values
self —setEastAsian()
public
setEastAsian(string $fontname) : self
Parameters
- $fontname : string
Return values
self —setItalic()
Set Italic.
public
setItalic(bool $italic) : $this
Parameters
- $italic : bool
Return values
$this —setLatin()
public
setLatin(string $fontname) : self
Parameters
- $fontname : string
Return values
self —setName()
Set Name and turn off Scheme.
public
setName(string $fontname) : self
Parameters
- $fontname : string
Return values
self —setScheme()
public
setScheme(string $scheme) : self
Parameters
- $scheme : string
Return values
self —setSize()
Set Size.
public
setSize(mixed $sizeInPoints[, bool $nullOk = false ]) : $this
Parameters
- $sizeInPoints : mixed
-
A float representing the value of a positive measurement in points (1/72 of an inch)
- $nullOk : bool = false
Return values
$this —setStrikethrough()
Set Strikethrough.
public
setStrikethrough(bool $strikethru) : $this
Parameters
- $strikethru : bool
Return values
$this —setStrikeType()
public
setStrikeType(string $strikeType) : self
Parameters
- $strikeType : string
Return values
self —setSubscript()
Set Subscript.
public
setSubscript(bool $subscript) : $this
Parameters
- $subscript : bool
Return values
$this —setSuperscript()
Set Superscript.
public
setSuperscript(bool $superscript) : $this
Parameters
- $superscript : bool
Return values
$this —setUnderline()
Set Underline.
public
setUnderline(bool|string $underlineStyle) : $this
Parameters
- $underlineStyle : bool|string
-
\PhpOffice\PhpSpreadsheet\Style\Font underline type If a boolean is passed, then TRUE equates to UNDERLINE_SINGLE, false equates to UNDERLINE_NONE
Return values
$this —setUnderlineColor()
public
setUnderlineColor(array<string|int, mixed> $colorArray) : self
Parameters
- $colorArray : array<string|int, mixed>
Return values
self —exportArray1()
Abstract method to be implemented in anything which extends this class.
protected
exportArray1() : array<string|int, mixed>
This method invokes exportArray2 with the names and values of all properties to be included in output array, returning that array to exportArray, then to caller.
Return values
array<string|int, mixed> —exportArray2()
Populate array from exportArray1.
protected
final exportArray2(array<string|int, mixed> &$exportedArray, string $index, mixed $objOrValue) : void
This method is available to anything which extends this class. The parameter index is the key to be added to the array. The parameter objOrValue is either a primitive type, which is the value added to the array, or a Style object to be recursively added via exportArray.
Parameters
- $exportedArray : array<string|int, mixed>
- $index : string
- $objOrValue : mixed
Return values
void —hashChartColor()
private
hashChartColor(ChartColor|null $underlineColor) : string
Parameters
- $underlineColor : ChartColor|null