Properties

$parent

$parent : \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

Parent worksheet.

Type

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

$currentCell

$currentCell : \PhpOffice\PhpSpreadsheet\Cell\Cell

The currently active Cell.

Type

\PhpOffice\PhpSpreadsheet\Cell\Cell

$currentCoordinate

$currentCoordinate : string

Coordinate of the currently active Cell.

Type

string

$currentCellIsDirty

$currentCellIsDirty : boolean

Flag indicating whether the currently active Cell requires saving.

Type

boolean

$index

$index : array<mixed,boolean>

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

Type

array<mixed,boolean>

$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) 

Initialise this new cell collection.

Parameters

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet $parent

The worksheet for this cell collection

\Psr\SimpleCache\CacheInterface $cache

getParent()

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

Return the parent worksheet for this cell collection.

Returns

\PhpOffice\PhpSpreadsheet\Worksheet\Worksheet

has()

has(string  $pCoord) : boolean

Whether the collection holds a cell for the given coordinate.

Parameters

string $pCoord

Coordinate of the cell to check

Returns

boolean

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

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell

delete()

delete(string  $pCoord) 

Delete a cell in cache identified by coordinate.

Parameters

string $pCoord

Coordinate of the cell to delete

getCoordinates()

getCoordinates() : array<mixed,string>

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

Returns

array<mixed,string>

getSortedCoordinates()

getSortedCoordinates() : array<mixed,string>

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

Returns

array<mixed,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() : integer

Return the row coordinate of the currently active cell object.

Returns

integer

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) : integer

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

integer —

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) 

Remove a row, deleting all cells in that row.

Parameters

string $row

Row number to remove

removeColumn()

removeColumn(string  $column) 

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

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell

get()

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

Get cell at a specific coordinate.

Parameters

string $pCoord

Coordinate of the cell

Throws

\PhpOffice\PhpSpreadsheet\Exception

Returns

\PhpOffice\PhpSpreadsheet\Cell\Cell —

Cell that was found, or null if not found

unsetWorksheetCells()

unsetWorksheetCells() 

Clear the cell collection and disconnect from our parent.

__destruct()

__destruct() 

Destroy this cell collection.

getUniqueID()

getUniqueID() : string

Generate a unique ID for cache referencing.

Returns

string —

Unique Reference

storeCurrentCell()

storeCurrentCell() 

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

Throws

\PhpOffice\PhpSpreadsheet\Exception

getAllCacheKeys()

getAllCacheKeys() : \Generator|array<mixed,string>

Returns all known cache keys.

Returns

\Generator|array<mixed,string>