Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
PhpOffice\PhpSpreadsheet\Style\Font Class Reference
Inheritance diagram for PhpOffice\PhpSpreadsheet\Style\Font:
PhpOffice\PhpSpreadsheet\Style\Supervisor PhpOffice\PhpSpreadsheet\IComparable

Public Member Functions

 __construct (bool $isSupervisor=false, bool $isConditional=false)
 Create a new Font.
 
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy.
 
 applyFromArray (array $styleArray)
 Apply styles from array.
 
 bindParent (Spreadsheet|self $parent, ?string $parentPropertyName=null)
 Bind parent.
 
 exportArray ()
 Export style as array.
 
 getActiveCell ()
 Get the currently active cell coordinate in currently active sheet.
 
 getActiveSheet ()
 Get the currently active sheet.
 
 getBaseLine ()
 
 getBold ()
 Get Bold.
 
 getCap ()
 
 getChartColor ()
 
 getColor ()
 Get Color.
 
 getComplexScript ()
 
 getEastAsian ()
 
 getHashCode ()
 Get hash code.
 
 getIsSupervisor ()
 Is this a supervisor or a cell style component?
 
 getItalic ()
 Get Italic.
 
 getLatin ()
 
 getName ()
 Get Name.
 
 getScheme ()
 
 getSelectedCells ()
 Get the currently active cell coordinate in currently active sheet.
 
 getSharedComponent ()
 Get the shared style component for the currently active cell in currently active sheet.
 
 getSize ()
 Get Size.
 
 getStrikethrough ()
 Get Strikethrough.
 
 getStrikeType ()
 
 getStyleArray (array $array)
 Build style array from subcomponents.
 
 getSubscript ()
 Get Subscript.
 
 getSuperscript ()
 Get Superscript.
 
 getUnderline ()
 Get Underline.
 
 getUnderlineColor ()
 
 setBaseLine (int $baseLine)
 
 setBold (bool $bold)
 Set Bold.
 
 setCap (string $cap)
 Set capitalization attribute.
 
 setChartColor (array $colorArray)
 
 setChartColorFromObject (?ChartColor $chartColor)
 
 setColor (Color $color)
 Set Color.
 
 setComplexScript (string $fontname)
 
 setEastAsian (string $fontname)
 
 setItalic (bool $italic)
 Set Italic.
 
 setLatin (string $fontname)
 
 setName (string $fontname)
 Set Name and turn off Scheme.
 
 setScheme (string $scheme)
 
 setSize (mixed $sizeInPoints, bool $nullOk=false)
 Set Size.
 
 setStrikethrough (bool $strikethru)
 Set Strikethrough.
 
 setStrikeType (string $strikeType)
 
 setSubscript (bool $subscript)
 Set Subscript.
 
 setSuperscript (bool $superscript)
 Set Superscript.
 
 setUnderline ($underlineStyle)
 Set Underline.
 
 setUnderlineColor (array $colorArray)
 

Public Attributes

int $colorIndex = null
 
const CAP_ALL = 'all'
 
const CAP_NONE = 'none'
 
const CAP_SMALL = 'small'
 
const DEFAULT_FONT_NAME = 'Calibri'
 
const UNDERLINE_DOUBLE = 'double'
 
const UNDERLINE_DOUBLEACCOUNTING = 'doubleAccounting'
 
const UNDERLINE_NONE = 'none'
 
const UNDERLINE_SINGLE = 'single'
 
const UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'
 

Protected Member Functions

 exportArray1 ()
 Abstract method to be implemented in anything which extends this class.
 
 exportArray2 (array &$exportedArray, string $index, mixed $objOrValue)
 Populate array from exportArray1.
 

Protected Attributes

bool $bold = false
 Bold.
 
string $cap = null
 
Color $color
 Foreground color.
 
bool $isSupervisor
 
bool $italic = false
 Italic.
 
string $name = self::DEFAULT_FONT_NAME
 
Spreadsheet Supervisor $parent
 Parent.
 
string $parentPropertyName = null
 Parent property name.
 
string $scheme = ''
 
float $size = 11
 Font Size.
 
bool $strikethrough = false
 Strikethrough.
 
bool $subscript = false
 Subscript.
 
bool $superscript = false
 Superscript.
 
string $underline = self::UNDERLINE_NONE
 Underline.
 

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Style\Font::__construct ( bool $isSupervisor = false,
bool $isConditional = false )

Create a new Font.

Parameters
bool$isSupervisorFlag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are
bool$isConditionalFlag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are

Member Function Documentation

◆ __clone()

PhpOffice\PhpSpreadsheet\Style\Font::__clone ( )

Implement PHP __clone to create a deep clone, not just a shallow copy.

Reimplemented from PhpOffice\PhpSpreadsheet\Style\Supervisor.

◆ applyFromArray()

PhpOffice\PhpSpreadsheet\Style\Font::applyFromArray ( array $styleArray)

Apply styles from array.

$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
array$styleArrayArray containing style information
Return values
$this

◆ bindParent()

PhpOffice\PhpSpreadsheet\Style\Supervisor::bindParent ( Spreadsheet|self $parent,
?string $parentPropertyName = null )
inherited

Bind parent.

Only used for supervisor.

Return values
$this

◆ exportArray()

PhpOffice\PhpSpreadsheet\Style\Supervisor::exportArray ( )
finalinherited

Export style as array.

Available to anything which extends this class: Alignment, Border, Borders, Color, Fill, Font, NumberFormat, Protection, and Style.

◆ exportArray1()

PhpOffice\PhpSpreadsheet\Style\Font::exportArray1 ( )
protected

Abstract method to be implemented in anything which extends this class.

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.

Reimplemented from PhpOffice\PhpSpreadsheet\Style\Supervisor.

◆ exportArray2()

PhpOffice\PhpSpreadsheet\Style\Supervisor::exportArray2 ( array & $exportedArray,
string $index,
mixed $objOrValue )
finalprotectedinherited

Populate array from exportArray1.

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.

◆ getActiveCell()

PhpOffice\PhpSpreadsheet\Style\Supervisor::getActiveCell ( )
inherited

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor.

Return values
stringE.g. 'A1'

◆ getActiveSheet()

PhpOffice\PhpSpreadsheet\Style\Supervisor::getActiveSheet ( )
inherited

Get the currently active sheet.

Only used for supervisor.

◆ getHashCode()

PhpOffice\PhpSpreadsheet\Style\Font::getHashCode ( )

Get hash code.

Return values
stringHash code

Implements PhpOffice\PhpSpreadsheet\IComparable.

◆ getSelectedCells()

PhpOffice\PhpSpreadsheet\Style\Supervisor::getSelectedCells ( )
inherited

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor.

Return values
stringE.g. 'A1'

◆ getSharedComponent()

PhpOffice\PhpSpreadsheet\Style\Font::getSharedComponent ( )

Get the shared style component for the currently active cell in currently active sheet.

Only used for style supervisor.

Reimplemented from PhpOffice\PhpSpreadsheet\Style\Supervisor.

◆ getStyleArray()

PhpOffice\PhpSpreadsheet\Style\Font::getStyleArray ( array $array)

Build style array from subcomponents.

Reimplemented from PhpOffice\PhpSpreadsheet\Style\Supervisor.

◆ setBold()

PhpOffice\PhpSpreadsheet\Style\Font::setBold ( bool $bold)

Set Bold.

Return values
$this

◆ setCap()

PhpOffice\PhpSpreadsheet\Style\Font::setCap ( string $cap)

Set capitalization attribute.

If not one of the permitted values (all, small, or none), set it to null. This will be honored only for the font for chart titles. None is distinguished from null because null will inherit the current value, whereas 'none' will override it.

◆ setColor()

PhpOffice\PhpSpreadsheet\Style\Font::setColor ( Color $color)

Set Color.

Return values
$this

◆ setItalic()

PhpOffice\PhpSpreadsheet\Style\Font::setItalic ( bool $italic)

Set Italic.

Return values
$this

◆ setSize()

PhpOffice\PhpSpreadsheet\Style\Font::setSize ( mixed $sizeInPoints,
bool $nullOk = false )

Set Size.

Parameters
mixed$sizeInPointsA float representing the value of a positive measurement in points (1/72 of an inch)
Return values
$this

◆ setStrikethrough()

PhpOffice\PhpSpreadsheet\Style\Font::setStrikethrough ( bool $strikethru)

Set Strikethrough.

Return values
$this

◆ setSubscript()

PhpOffice\PhpSpreadsheet\Style\Font::setSubscript ( bool $subscript)

Set Subscript.

Return values
$this

◆ setSuperscript()

PhpOffice\PhpSpreadsheet\Style\Font::setSuperscript ( bool $superscript)

Set Superscript.

Return values
$this

◆ setUnderline()

PhpOffice\PhpSpreadsheet\Style\Font::setUnderline ( $underlineStyle)

Set Underline.

Parameters
bool | string$underlineStylePhpOffice\PhpSpreadsheet\Style\Font underline type If a boolean is passed, then TRUE equates to UNDERLINE_SINGLE, false equates to UNDERLINE_NONE
Return values
$this

Member Data Documentation

◆ $parent

Spreadsheet Supervisor PhpOffice\PhpSpreadsheet\Style\Supervisor::$parent
protectedinherited

Parent.

Only used for supervisor.


The documentation for this class was generated from the following file: