class Style extends Supervisor (View source)

Properties

protected bool $isSupervisor Supervisor? from Supervisor
protected Spreadsheet|Style $parent Parent. Only used for supervisor. from Supervisor
protected null|string $parentPropertyName Parent property name. from Supervisor
protected Font $font Font.
protected Fill $fill Fill.
protected Borders $borders Borders.
protected Alignment $alignment Alignment.
protected NumberFormat $numberFormat Number Format.
protected Conditional[] $conditionalStyles Conditional styles.
protected Protection $protection Protection.
protected int $index Index of style in collection. Only used for real style.
protected bool $quotePrefix Use Quote Prefix when displaying in cell editor. Only used for real style.

Methods

__construct(bool $isSupervisor = false, bool $isConditional = false)

Create a new Style.

bindParent(Spreadsheet|Style $parent, null|string $parentPropertyName = null)

Bind parent. Only used for supervisor.

bool
getIsSupervisor()

Is this a supervisor or a cell style component?

getActiveSheet()

Get the currently active sheet. Only used for supervisor.

string
getSelectedCells()

Get the currently active cell coordinate in currently active sheet.

string
getActiveCell()

Get the currently active cell coordinate in currently active sheet.

__clone()

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

getSharedComponent()

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

getParent()

Get parent. Only used for style supervisor.

array
getStyleArray(array $array)

Build style array from subcomponents.

applyFromArray(array $pStyles, bool $pAdvanced = true)

Apply styles from array.

getFill()

Get Fill.

getFont()

Get Font.

setFont(Font $font)

Set font.

getBorders()

Get Borders.

getAlignment()

Get Alignment.

getNumberFormat()

Get Number Format.

getConditionalStyles()

Get Conditional Styles. Only used on supervisor.

setConditionalStyles(array $pValue)

Set Conditional Styles. Only used on supervisor.

getProtection()

Get Protection.

bool
getQuotePrefix()

Get quote prefix.

setQuotePrefix(bool $pValue)

Set quote prefix.

string
getHashCode()

Get hash code.

int
getIndex()

Get own index in style collection.

setIndex(int $pValue)

Set own index in style collection.

Details

__construct(bool $isSupervisor = false, bool $isConditional = false)

Create a new Style.

Parameters

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

Supervisor bindParent(Spreadsheet|Style $parent, null|string $parentPropertyName = null)

Bind parent. Only used for supervisor.

Parameters

Spreadsheet|Style $parent
null|string $parentPropertyName

Return Value

Supervisor

bool getIsSupervisor()

Is this a supervisor or a cell style component?

Return Value

bool

Worksheet getActiveSheet()

Get the currently active sheet. Only used for supervisor.

Return Value

Worksheet

string getSelectedCells()

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor.

Return Value

string E.g. 'A1'

string getActiveCell()

Get the currently active cell coordinate in currently active sheet.

Only used for supervisor.

Return Value

string E.g. 'A1'

__clone()

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

Style getSharedComponent()

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

Only used for style supervisor.

Return Value

Style

Spreadsheet getParent()

Get parent. Only used for style supervisor.

Return Value

Spreadsheet

array getStyleArray(array $array)

Build style array from subcomponents.

Parameters

array $array

Return Value

array

Style applyFromArray(array $pStyles, bool $pAdvanced = 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 $pStyles Array containing style information
bool $pAdvanced advanced mode for setting borders

Return Value

Style

Fill getFill()

Get Fill.

Return Value

Fill

Font getFont()

Get Font.

Return Value

Font

Style setFont(Font $font)

Set font.

Parameters

Font $font

Return Value

Style

Borders getBorders()

Get Borders.

Return Value

Borders

Alignment getAlignment()

Get Alignment.

Return Value

Alignment

NumberFormat getNumberFormat()

Get Number Format.

Return Value

NumberFormat

Conditional[] getConditionalStyles()

Get Conditional Styles. Only used on supervisor.

Return Value

Conditional[]

Style setConditionalStyles(array $pValue)

Set Conditional Styles. Only used on supervisor.

Parameters

array $pValue Array of conditional styles

Return Value

Style

Protection getProtection()

Get Protection.

Return Value

Protection

bool getQuotePrefix()

Get quote prefix.

Return Value

bool

Style setQuotePrefix(bool $pValue)

Set quote prefix.

Parameters

bool $pValue

Return Value

Style

string getHashCode()

Get hash code.

Return Value

string Hash code

int getIndex()

Get own index in style collection.

Return Value

int

setIndex(int $pValue)

Set own index in style collection.

Parameters

int $pValue