Properties

$cache

$cache : \Psr\SimpleCache\CacheInterface

Type

CacheInterface

$parent

$parent : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Parent worksheet.

Type

Worksheet

$currentCell

$currentCell : \PhpOffice\PhpSpreadsheet\Cell\Cell

The currently active Cell.

Type

Cell

$currentCoordinate

$currentCoordinate : string

Coordinate of the currently active Cell.

Type

string

$currentCellIsDirty

$currentCellIsDirty : bool

Flag indicating whether the currently active Cell requires saving.

Type

bool

$index

$index : bool[]

An index of existing cells. Booleans indexed by their coordinate.

Type

bool[]

$cachePrefix

$cachePrefix : string

Prefix used to uniquely identify cache data for this worksheet.

Type

string

Methods

__construct()

__construct(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet  $parent, \Psr\SimpleCache\CacheInterface  $cache) : mixed

Initialise this new cell collection.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $parent

The worksheet for this cell collection

\Psr\SimpleCache\CacheInterface $cache

Returns

mixed —

getParent()

getParent() : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Return the parent worksheet for this cell collection.

Returns

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet —

has()

has(string  $pCoord) : bool

Whether the collection holds a cell for the given coordinate.

Parameters

string $pCoord

Coordinate of the cell to check

Returns

bool —

update()

update(\PhpOffice\PhpSpreadsheet\Cell\Cell  $cell) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Add or update a cell in the collection.

Parameters

\PhpOffice\PhpSpreadsheet\Cell\Cell $cell

Cell to update

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell —

delete()

delete(string  $pCoord) : void

Delete a cell in cache identified by coordinate.

Parameters

string $pCoord

Coordinate of the cell to delete

getCoordinates()

getCoordinates() : string[]

Get a list of all cell coordinates currently held in the collection.

Returns

string[] —

getSortedCoordinates()

getSortedCoordinates() : string[]

Get a sorted list of all cell coordinates currently held in the collection by row and column.

Returns

string[] —

getHighestRowAndColumn()

getHighestRowAndColumn() : array

Get highest worksheet column and highest row that have cell records.

Returns

array —

Highest column name and highest row number

getCurrentCoordinate()

getCurrentCoordinate() : string

Return the cell coordinate of the currently active cell object.

Returns

string —

getCurrentColumn()

getCurrentColumn() : string

Return the column coordinate of the currently active cell object.

Returns

string —

getCurrentRow()

getCurrentRow() : int

Return the row coordinate of the currently active cell object.

Returns

int —

getHighestColumn()

getHighestColumn(string  $row = null) : string

Get highest worksheet column.

Parameters

string $row

Return the highest column for the specified row, or the highest column of any row if no row number is passed

Returns

string —

Highest column name

getHighestRow()

getHighestRow(string  $column = null) : int

Get highest worksheet row.

Parameters

string $column

Return the highest row for the specified column, or the highest row of any column if no column letter is passed

Returns

int —

Highest row number

cloneCellCollection()

cloneCellCollection(\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet  $parent) : self

Clone the cell collection.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $parent

The new worksheet that we're copying to

Returns

self —

removeRow()

removeRow(string  $row) : void

Remove a row, deleting all cells in that row.

Parameters

string $row

Row number to remove

removeColumn()

removeColumn(string  $column) : void

Remove a column, deleting all cells in that column.

Parameters

string $column

Column ID to remove

add()

add(string  $pCoord, \PhpOffice\PhpSpreadsheet\Cell\Cell  $cell) : \PhpOffice\PhpSpreadsheet\Cell\Cell

Add or update a cell identified by its coordinate into the collection.

Parameters

string $pCoord

Coordinate of the cell to update

\PhpOffice\PhpSpreadsheet\Cell\Cell $cell

Cell to update

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell —

get()

get(string  $pCoord) : null|\PhpOffice\PhpSpreadsheet\Cell\Cell

Get cell at a specific coordinate.

Parameters

string $pCoord

Coordinate of the cell

Returns

null|\PhpOffice\PhpSpreadsheet\Cell\Cell —

Cell that was found, or null if not found

unsetWorksheetCells()

unsetWorksheetCells() : void

Clear the cell collection and disconnect from our parent.

__destruct()

__destruct() : mixed

Destroy this cell collection.

Returns

mixed —

getUniqueID()

getUniqueID() : string

Generate a unique ID for cache referencing.

Returns

string —

Unique Reference

storeCurrentCell()

storeCurrentCell() : void

Store cell data in cache for the current cell object if it's "dirty", and the 'nullify' the current cell object.

getAllCacheKeys()

getAllCacheKeys() : \Generator|string[]

Returns all known cache keys.

Returns

\Generator|string[] —