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

Public Member Functions

 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy.
 
 applyFromArray (array $styleArray, bool $advancedBorders=true)
 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.
 
 getAlignment ()
 Get Alignment.
 
 getBorders ()
 Get Borders.
 
 getConditionalStyles ()
 Get Conditional Styles.
 
 getFill ()
 Get Fill.
 
 getFont ()
 Get Font.
 
 getHashCode ()
 Get hash code.
 
 getIndex ()
 Get own index in style collection.
 
 getIsSupervisor ()
 Is this a supervisor or a cell style component?
 
 getNumberFormat ()
 Get Number Format.
 
 getParent ()
 Get parent.
 
 getProtection ()
 Get Protection.
 
 getQuotePrefix ()
 Get quote prefix.
 
 getSelectedCells ()
 Get the currently active cell coordinate in currently active sheet.
 
if( $isSupervisor) getSharedComponent ()
 Get the shared style component for the currently active cell in currently active sheet.
 
 getStyleArray (array $array)
 Build style array from subcomponents.
 
 setConditionalStyles (array $conditionalStyleArray)
 Set Conditional Styles.
 
 setFont (Font $font)
 Set font.
 
 setIndex (int $index)
 Set own index in style collection.
 
 setQuotePrefix (bool $quotePrefix)
 Set quote prefix.
 

Public Attributes

$this alignment = new Alignment($isSupervisor, $isConditional)
 
$this borders = new Borders($isSupervisor, $isConditional)
 
$this fill = new Fill($isSupervisor, $isConditional)
 
$this numberFormat = new NumberFormat($isSupervisor, $isConditional)
 
$this protection = new Protection($isSupervisor, $isConditional)
 

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

Alignment $alignment
 Alignment.
 
Borders $borders
 Borders.
 
Fill $fill
 Fill.
 
Font $font
 
int $index
 Index of style in collection.
 
bool $isSupervisor
 
NumberFormat $numberFormat
 Number Format.
 
Spreadsheet Supervisor $parent
 Parent.
 
string $parentPropertyName = null
 Parent property name.
 
Protection $protection
 Protection.
 
bool $quotePrefix = false
 Use Quote Prefix when displaying in cell editor.
 

Member Function Documentation

◆ __clone()

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

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

Reimplemented in PhpOffice\PhpSpreadsheet\Style\Font.

◆ applyFromArray()

PhpOffice\PhpSpreadsheet\Style\Style::applyFromArray ( array $styleArray,
bool $advancedBorders = true )

Apply styles from array.

$spreadsheet->getActiveSheet()->getStyle('B2')->applyFromArray( [ 'font' => [ 'name' => 'Arial', 'bold' => true, 'italic' => false, 'underline' => Font::UNDERLINE_DOUBLE, 'strikethrough' => false, 'color' => [ 'rgb' => '808080' ] ], 'borders' => [ 'bottom' => [ 'borderStyle' => Border::BORDER_DASHDOT, 'color' => [ 'rgb' => '808080' ] ], 'top' => [ 'borderStyle' => Border::BORDER_DASHDOT, 'color' => [ 'rgb' => '808080' ] ] ], 'alignment' => [ 'horizontal' => Alignment::HORIZONTAL_CENTER, 'vertical' => Alignment::VERTICAL_CENTER, 'wrapText' => true, ], 'quotePrefix' => true ] );

Parameters
array$styleArrayArray containing style information
bool$advancedBordersadvanced mode for setting borders
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\Style::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.

◆ getConditionalStyles()

PhpOffice\PhpSpreadsheet\Style\Style::getConditionalStyles ( )

Get Conditional Styles.

Only used on supervisor.

Return values
Conditional[]

◆ getHashCode()

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

Get hash code.

Return values
stringHash code

Implements PhpOffice\PhpSpreadsheet\IComparable.

◆ getParent()

PhpOffice\PhpSpreadsheet\Style\Style::getParent ( )

Get parent.

Only used for style supervisor.

◆ 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()

if($isSupervisor) PhpOffice\PhpSpreadsheet\Style\Style::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\Style::getStyleArray ( array $array)

Build style array from subcomponents.

Reimplemented from PhpOffice\PhpSpreadsheet\Style\Supervisor.

◆ setConditionalStyles()

PhpOffice\PhpSpreadsheet\Style\Style::setConditionalStyles ( array $conditionalStyleArray)

Set Conditional Styles.

Only used on supervisor.

Parameters
Conditional[]$conditionalStyleArrayArray of conditional styles
Return values
$this

◆ setFont()

PhpOffice\PhpSpreadsheet\Style\Style::setFont ( Font $font)

Set font.

Return values
$this

◆ setQuotePrefix()

PhpOffice\PhpSpreadsheet\Style\Style::setQuotePrefix ( bool $quotePrefix)

Set quote prefix.

Return values
$this

Member Data Documentation

◆ $index

int PhpOffice\PhpSpreadsheet\Style\Style::$index
protected

Index of style in collection.

Only used for real style.

◆ $parent

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

Parent.

Only used for supervisor.

◆ $quotePrefix

bool PhpOffice\PhpSpreadsheet\Style\Style::$quotePrefix = false
protected

Use Quote Prefix when displaying in cell editor.

Only used for real style.


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