class Alignment extends Supervisor (View source)

Constants

HORIZONTAL_GENERAL

HORIZONTAL_LEFT

HORIZONTAL_RIGHT

HORIZONTAL_CENTER

HORIZONTAL_CENTER_CONTINUOUS

HORIZONTAL_JUSTIFY

HORIZONTAL_FILL

HORIZONTAL_DISTRIBUTED

VERTICAL_BOTTOM

VERTICAL_TOP

VERTICAL_CENTER

VERTICAL_JUSTIFY

VERTICAL_DISTRIBUTED

READORDER_CONTEXT

READORDER_LTR

READORDER_RTL

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 string $horizontal Horizontal alignment.
protected string $vertical Vertical alignment.
protected int $textRotation Text rotation.
protected bool $wrapText Wrap text.
protected bool $shrinkToFit Shrink to fit.
protected int $indent Indent - only possible with horizontal alignment left and right.
protected int $readOrder Read order.

Methods

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

Create a new Alignment.

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.

array
getStyleArray(array $array)

Build style array from subcomponents.

applyFromArray(array $pStyles)

Apply styles from array.

string
getHorizontal()

Get Horizontal.

setHorizontal(string $pValue)

Set Horizontal.

string
getVertical()

Get Vertical.

setVertical(string $pValue)

Set Vertical.

int
getTextRotation()

Get TextRotation.

setTextRotation(int $pValue)

Set TextRotation.

bool
getWrapText()

Get Wrap Text.

setWrapText(bool $pValue)

Set Wrap Text.

bool
getShrinkToFit()

Get Shrink to fit.

setShrinkToFit(bool $pValue)

Set Shrink to fit.

int
getIndent()

Get indent.

setIndent(int $pValue)

Set indent.

int
getReadOrder()

Get read order.

setReadOrder(int $pValue)

Set read order.

string
getHashCode()

Get hash code.

Details

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

Create a new Alignment.

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.

Alignment getSharedComponent()

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

Only used for style supervisor.

Return Value

Alignment

array getStyleArray(array $array)

Build style array from subcomponents.

Parameters

array $array

Return Value

array

Alignment applyFromArray(array $pStyles)

Apply styles from array.

$spreadsheet->getActiveSheet()->getStyle('B2')->getAlignment()->applyFromArray( [ 'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER, 'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER, 'textRotation' => 0, 'wrapText' => TRUE ] );

Parameters

array $pStyles Array containing style information

Return Value

Alignment

Exceptions

Exception

string getHorizontal()

Get Horizontal.

Return Value

string

Alignment setHorizontal(string $pValue)

Set Horizontal.

Parameters

string $pValue see self::HORIZONTAL_*

Return Value

Alignment

string getVertical()

Get Vertical.

Return Value

string

Alignment setVertical(string $pValue)

Set Vertical.

Parameters

string $pValue see self::VERTICAL_*

Return Value

Alignment

int getTextRotation()

Get TextRotation.

Return Value

int

Alignment setTextRotation(int $pValue)

Set TextRotation.

Parameters

int $pValue

Return Value

Alignment

Exceptions

Exception

bool getWrapText()

Get Wrap Text.

Return Value

bool

Alignment setWrapText(bool $pValue)

Set Wrap Text.

Parameters

bool $pValue

Return Value

Alignment

bool getShrinkToFit()

Get Shrink to fit.

Return Value

bool

Alignment setShrinkToFit(bool $pValue)

Set Shrink to fit.

Parameters

bool $pValue

Return Value

Alignment

int getIndent()

Get indent.

Return Value

int

Alignment setIndent(int $pValue)

Set indent.

Parameters

int $pValue

Return Value

Alignment

int getReadOrder()

Get read order.

Return Value

int

Alignment setReadOrder(int $pValue)

Set read order.

Parameters

int $pValue

Return Value

Alignment

string getHashCode()

Get hash code.

Return Value

string Hash code