Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
PhpOffice\PhpSpreadsheet\Worksheet\Worksheet Class Reference

Public Member Functions

 __construct (?Spreadsheet $parent=null, string $title='Worksheet')
 Create a new worksheet.
 
 __destruct ()
 Code to execute when this worksheet is unset().
 
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy.
 
 __wakeup ()
 
 addChart (Chart $chart)
 
 addTable (Table $table)
 Add Table.
 
 applyStylesFromArray (string $coordinate, array $styleArray)
 
 calculateArrays (bool $preCalculateFormulas=true)
 
 calculateColumnWidths ()
 Calculate widths for auto-size columns.
 
 calculateWorksheetDataDimension ()
 Calculate worksheet data dimension.
 
 calculateWorksheetDimension ()
 Calculate worksheet dimension.
 
 cellExists (CellAddress|string|array $coordinate)
 Does the cell at a specific coordinate exist?
 
 columnDimensionExists (string $column)
 
 conditionalStylesExists (string $coordinate)
 Do conditional styles exist for this cell?
 
 copy ()
 Copy worksheet (!= clone!).
 
 copyCells (string $fromCell, string $toCells, bool $copyStyle=true)
 Copy cells, adjusting relative cell references in formulas.
 
 createNewCell (string $coordinate)
 Create a new cell at the specified coordinate.
 
 dataValidationExists (string $coordinate)
 Data validation at a specific coordinate exists?
 
 disconnectCells ()
 Disconnect all cells from this Worksheet object, typically so that the worksheet object can be unset.
 
 duplicateConditionalStyle (array $styles, string $range='')
 Duplicate conditional style to a range of cells.
 
 duplicateStyle (Style $style, string $range)
 Duplicate cell style to a range of cells.
 
 freezePane (null|CellAddress|string|array $coordinate, null|CellAddress|string|array $topLeftCell=null, bool $frozenSplit=false)
 Freeze Pane.
 
 fromArray (array $source, mixed $nullValue=null, string $startCell='A1', bool $strictNullComparison=false)
 Fill worksheet from values in array.
 
 garbageCollect ()
 Run PhpSpreadsheet garbage collector.
 
 getActiveCell ()
 Get active cell.
 
 getActivePane ()
 
 getAutoFilter ()
 Get Autofilter.
 
 getBackgroundExtension ()
 
 getBackgroundImage ()
 
 getBackgroundMime ()
 
 getBreaks ()
 Get breaks.
 
 getCell (CellAddress|string|array $coordinate)
 Get cell at a specific coordinate.
 
 getCellCollection ()
 Return the cell collection.
 
 getChartByIndex (?string $index)
 Get a chart by its index position.
 
 getChartByName (string $chartName)
 Get a chart by name.
 
 getChartByNameOrThrow (string $chartName)
 
 getChartCollection ()
 Get collection of charts.
 
 getChartCount ()
 Return the count of charts on this worksheet.
 
 getChartNames ()
 Return an array of the names of charts on this worksheet.
 
 getCodeName ()
 Return the code name of the sheet.
 
 getColumnBreaks ()
 Get column breaks.
 
 getColumnDimension (string $column)
 Get column dimension at a specific column.
 
 getColumnDimensionByColumn (int $columnIndex)
 Get column dimension at a specific column by using numeric cell coordinates.
 
 getColumnDimensions ()
 Get collection of column dimensions.
 
 getColumnIterator (string $startColumn='A', ?string $endColumn=null)
 Get column iterator.
 
 getColumnStyle (string $column)
 
 getComment (CellAddress|string|array $cellCoordinate, bool $attachNew=true)
 Get comment for cell.
 
 getComments ()
 Get comments.
 
 getConditionalRange (string $coordinate)
 
 getConditionalStyles (string $coordinate, bool $firstOnly=true)
 Get conditional styles for a cell.
 
 getConditionalStylesCollection ()
 Get collection of conditional styles.
 
 getCoordinates (bool $sorted=true)
 Get a sorted list of all cell coordinates currently held in the collection by row and column.
 
 getDataValidation (string $cellCoordinate)
 Get data validation.
 
 getDataValidationCollection ()
 Get collection of data validations.
 
 getDefaultColumnDimension ()
 Get default column dimension.
 
 getDefaultRowDimension ()
 Get default row dimension.
 
 getDrawingCollection ()
 Get collection of drawings.
 
 getFreezePane ()
 Get Freeze Pane.
 
 getHashInt ()
 
 getHeaderFooter ()
 Get page header/footer.
 
 getHighestColumn ($row=null)
 Get highest worksheet column.
 
 getHighestDataColumn ($row=null)
 Get highest worksheet column that contains data.
 
 getHighestDataRow (?string $column=null)
 Get highest worksheet row that contains data.
 
 getHighestRow (?string $column=null)
 Get highest worksheet row.
 
 getHighestRowAndColumn ()
 Get highest worksheet column and highest row that have cell records.
 
 getHyperlink (string $cellCoordinate)
 Get hyperlink.
 
 getHyperlinkCollection ()
 Get collection of hyperlinks.
 
 getMergeCells ()
 Get merge cells array.
 
 getPageMargins ()
 Get page margins.
 
 getPageSetup ()
 Get page setup.
 
 getPane (string $position)
 
 getPanes ()
 
 getPaneState ()
 
 getPaneTopLeftCell ()
 
 getParent ()
 Get parent or null.
 
 getParentOrThrow ()
 Get parent, throw exception if null.
 
 getPrintGridlines ()
 Print gridlines?
 
 getProtectedCellRanges ()
 Get protected cells.
 
 getProtection ()
 Get Protection.
 
 getRightToLeft ()
 Get right-to-left.
 
 getRowBreaks ()
 Get row breaks.
 
 getRowDimension (int $row)
 Get row dimension at a specific row.
 
 getRowDimensions ()
 Get collection of row dimensions.
 
 getRowIterator (int $startRow=1, ?int $endRow=null)
 Get row iterator.
 
 getRowStyle (int $row)
 
 getSelectedCells ()
 Get selected cells.
 
 getSheetState ()
 Get sheet state.
 
 getSheetView ()
 Get sheet view.
 
 getShowGridlines ()
 Show gridlines?
 
 getShowRowColHeaders ()
 Show row and column headers?
 
 getShowSummaryBelow ()
 Show summary below?
 
 getShowSummaryRight ()
 Show summary right?
 
 getStyle (AddressRange|CellAddress|int|string|array $cellCoordinate)
 Get style for cell.
 
 getTabColor ()
 Get tab color.
 
 getTableByName (string $name)
 
 getTableCollection ()
 Get collection of Tables.
 
 getTableNames ()
 
 getTitle ()
 Get title.
 
 getTopLeftCell ()
 Get the default position of the right bottom pane.
 
 getXSplit ()
 
 getYSplit ()
 
 hasCodeName ()
 Sheet has a code name ?
 
 hyperlinkExists (string $coordinate)
 Hyperlink at a specific coordinate exists?
 
 insertNewColumnBefore (string $before, int $numberOfColumns=1)
 Insert a new column, updating all possible related data.
 
 insertNewColumnBeforeByIndex (int $beforeColumnIndex, int $numberOfColumns=1)
 Insert a new column, updating all possible related data.
 
 insertNewRowBefore (int $before, int $numberOfRows=1)
 Insert a new row, updating all possible related data.
 
 isCellHiddenOnFormulaBar (string $coordinate)
 Same as Cell->isHiddenOnFormulaBar, but without creating cell if it doesn't exist.
 
 isCellInSpillRange (string $coordinate)
 
 isCellLocked (string $coordinate)
 Same as Cell->isLocked, but without creating cell if it doesn't exist.
 
 isEmptyColumn (string $columnId, int $definitionOfEmptyFlags=0)
 Returns a boolean true if the specified column contains no cells.
 
 isEmptyRow (int $rowId, int $definitionOfEmptyFlags=0)
 Returns a boolean true if the specified row contains no cells.
 
 isRowVisible (int $row)
 
 isTabColorSet ()
 Tab color set?
 
 mergeCellBehaviour (Cell $cell, string $upperLeft, string $behaviour, array $leftCellValue)
 
 mergeCells (AddressRange|string|array $range, string $behaviour=self::MERGE_CELL_CONTENT_EMPTY)
 Set merge on a cell range.
 
 namedRangeToArray (string $definedName, mixed $nullValue=null, bool $calculateFormulas=true, bool $formatData=true, bool $returnCellRef=false, bool $ignoreHidden=false, bool $reduceArrays=false)
 Create array from a range of cells.
 
 protectCells (AddressRange|CellAddress|int|string|array $range, string $password='', bool $alreadyHashed=false, string $name='', string $securityDescriptor='')
 Set protection on a cell or cell range.
 
 rangeToArray (string $range, mixed $nullValue=null, bool $calculateFormulas=true, bool $formatData=true, bool $returnCellRef=false, bool $ignoreHidden=false, bool $reduceArrays=false)
 Create array from a range of cells.
 
 rangeToArrayYieldRows (string $range, mixed $nullValue=null, bool $calculateFormulas=true, bool $formatData=true, bool $returnCellRef=false, bool $ignoreHidden=false, bool $reduceArrays=false)
 Create array from a range of cells, yielding each row in turn.
 
 rebindParent (Spreadsheet $parent)
 Re-bind parent.
 
 refreshColumnDimensions ()
 Refresh column dimensions.
 
 refreshRowDimensions ()
 Refresh row dimensions.
 
 removeAutoFilter ()
 Remove autofilter.
 
 removeColumn (string $column, int $numberOfColumns=1)
 Remove a column, updating all possible related data.
 
 removeColumnByIndex (int $columnIndex, int $numColumns=1)
 Remove a column, updating all possible related data.
 
 removeComment (CellAddress|string|array $cellCoordinate)
 Remove comment from cell.
 
 removeConditionalStyles (string $coordinate)
 Removes conditional styles for a cell.
 
 removeRow (int $row, int $numberOfRows=1)
 Delete a row, updating all possible related data.
 
 removeTableByName (string $name)
 Remove Table by name.
 
 removeTableCollection ()
 Remove collection of Tables.
 
 resetTabColor ()
 Reset tab color.
 
 rowDimensionExists (int $row)
 
 setActivePane (string $activePane)
 
 setAutoFilter (AddressRange|string|array|AutoFilter $autoFilterOrRange)
 Set AutoFilter.
 
 setBackgroundImage (string $backgroundImage)
 Set background image.
 
 setBreak (CellAddress|string|array $coordinate, int $break, int $max=-1)
 Set break on a cell.
 
 setCellValue (CellAddress|string|array $coordinate, mixed $value, ?IValueBinder $binder=null)
 Set a cell value.
 
 setCellValueExplicit (CellAddress|string|array $coordinate, mixed $value, string $dataType)
 Set a cell value.
 
 setCodeName (string $codeName, bool $validate=true)
 Define the code name of the sheet.
 
 setComments (array $comments)
 Set comments array for the entire sheet.
 
 setConditionalStyles (string $coordinate, array $styles)
 Set conditional styles.
 
 setDataValidation (string $cellCoordinate, ?DataValidation $dataValidation=null)
 Set data validation.
 
 setHeaderFooter (HeaderFooter $headerFooter)
 Set page header/footer.
 
 setHyperlink (string $cellCoordinate, ?Hyperlink $hyperlink=null)
 Set hyperlink.
 
 setMergeCells (array $mergeCells)
 Set merge cells array for the entire sheet.
 
 setPageMargins (PageMargins $pageMargins)
 Set page margins.
 
 setPageSetup (PageSetup $pageSetup)
 Set page setup.
 
 setPane (string $position, ?Pane $pane)
 
 setPaneState (string $paneState)
 
 setPaneTopLeftCell (string $paneTopLeftCell)
 
 setParent (Spreadsheet $parent)
 
 setPrintGridlines (bool $printGridLines)
 Set print gridlines.
 
 setProtection (Protection $protection)
 Set Protection.
 
 setRightToLeft (bool $value)
 Set right-to-left.
 
 setSelectedCell (string $coordinate)
 Selected cell.
 
 setSelectedCells (AddressRange|CellAddress|int|string|array $coordinate)
 Select a range of cells.
 
 setSheetState (string $value)
 Set sheet state.
 
 setSheetView (SheetView $sheetView)
 Set sheet view.
 
 setShowGridlines (bool $showGridLines)
 Set show gridlines.
 
 setShowRowColHeaders (bool $showRowColHeaders)
 Set show row and column headers.
 
 setShowSummaryBelow (bool $showSummaryBelow)
 Set show summary below.
 
 setShowSummaryRight (bool $showSummaryRight)
 Set show summary right.
 
 setTitle (string $title, bool $updateFormulaCellReferences=true, bool $validate=true)
 Set title.
 
 setTopLeftCell (string $topLeftCell)
 
 setXSplit (int $xSplit)
 
 setYSplit (int $ySplit)
 
 shrinkRangeToFit (string $range)
 Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet.
 
 toArray (mixed $nullValue=null, bool $calculateFormulas=true, bool $formatData=true, bool $returnCellRef=false, bool $ignoreHidden=false, bool $reduceArrays=false)
 Create array from worksheet.
 
 unfreezePane ()
 Unfreeze Pane.
 
 unmergeCells (AddressRange|string|array $range)
 Remove merge on a cell range.
 
 unprotectCells (AddressRange|CellAddress|int|string|array $range)
 Remove protection on a cell or cell range.
 
 usesPanes ()
 

Static Public Member Functions

static extractSheetTitle (?string $range, bool $returnRange=false, bool $unapostrophize=false)
 Extract worksheet title from range.
 
static getInvalidCharacters ()
 Get array of invalid characters for sheet title.
 
static nameRequiresQuotes (string $sheetName)
 
static unApostrophizeTitle (?string $title)
 

Public Attributes

const BREAK_COLUMN = 2
 
const BREAK_NONE = 0
 
const BREAK_ROW = 1
 
const BREAK_ROW_MAX_COLUMN = 16383
 
const FUNCTION_LIKE_GROUPBY = '/\b(groupby|_xleta)\b/i'
 
const MERGE_CELL_CONTENT_EMPTY = 'empty'
 
const MERGE_CELL_CONTENT_HIDE = 'hide'
 
const MERGE_CELL_CONTENT_MERGE = 'merge'
 
const PANE_FROZEN = 'frozen'
 
const PANE_FROZENSPLIT = 'frozenSplit'
 
const PANE_SPLIT = 'split'
 
int const SHEET_TITLE_MAXIMUM_LENGTH = 31
 
const SHEETSTATE_HIDDEN = 'hidden'
 
const SHEETSTATE_VERYHIDDEN = 'veryHidden'
 
const SHEETSTATE_VISIBLE = 'visible'
 

Protected Member Functions

 cellToArray (Cell $cell, bool $calculateFormulas, bool $formatData, mixed $nullValue)
 
 getTableIndexByName (string $name)
 

Static Protected Member Functions

static compareColumnBreaks (string $coordinate1, string $coordinate2)
 
static compareRowBreaks (string $coordinate1, string $coordinate2)
 

Protected Attributes

const SHEET_NAME_REQUIRES_NO_QUOTES = '/^[_\p{L}][_\p{L}\p{N}]*$/mui'
 

Member Function Documentation

◆ addTable()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::addTable ( Table $table)

Add Table.

Return values
$this

◆ calculateColumnWidths()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::calculateColumnWidths ( )

Calculate widths for auto-size columns.

Return values
$this

◆ calculateWorksheetDataDimension()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::calculateWorksheetDataDimension ( )

Calculate worksheet data dimension.

Return values
stringString containing the dimension of this worksheet that actually contain data

◆ calculateWorksheetDimension()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::calculateWorksheetDimension ( )

Calculate worksheet dimension.

Return values
stringString containing the dimension of this worksheet

◆ cellExists()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::cellExists ( CellAddress|string|array $coordinate)

Does the cell at a specific coordinate exist?

Parameters
array{0int, 1: int}|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object.

◆ cellToArray()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::cellToArray ( Cell $cell,
bool $calculateFormulas,
bool $formatData,
mixed $nullValue )
protected
Parameters
null | bool | float | int | RichText | string$nullValuevalue to use when null
Exceptions
Exception
PhpOffice\PhpSpreadsheet\Calculation\Exception

◆ conditionalStylesExists()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::conditionalStylesExists ( string $coordinate)

Do conditional styles exist for this cell?

Parameters
string$coordinateeg: 'A1' or 'A1:A3'. If a single cell is specified, then this method will return true if that cell is included in a conditional style range. If a range of cells is specified, then true will only be returned if the range matches the entire range of the conditional.

◆ copyCells()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::copyCells ( string $fromCell,
string $toCells,
bool $copyStyle = true )

Copy cells, adjusting relative cell references in formulas.

Acts similarly to Excel "fill handle" feature.

Parameters
string$fromCellSingle source cell, e.g. C3
string$toCellsSingle cell or cell range, e.g. C4 or C4:C10
bool$copyStyleCopy styles as well as values, defaults to true

◆ createNewCell()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::createNewCell ( string $coordinate)

Create a new cell at the specified coordinate.

Parameters
string$coordinateCoordinate of the cell
Return values
CellCell that was created WARNING: Because the cell collection can be cached to reduce memory, it only allows one "active" cell at a time in memory. If you assign that cell to a variable, then select another cell using getCell() or any of its variants, the newly selected cell becomes the "active" cell, and any previous assignment becomes a disconnected reference because the active cell has changed.

◆ dataValidationExists()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::dataValidationExists ( string $coordinate)

Data validation at a specific coordinate exists?

Parameters
string$coordinateeg: 'A1'

◆ duplicateConditionalStyle()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::duplicateConditionalStyle ( array $styles,
string $range = '' )

Duplicate conditional style to a range of cells.

Please note that this will overwrite existing cell styles for cells in range!

Parameters
Conditional[]$stylesCell style to duplicate
string$rangeRange of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
Return values
$this

◆ duplicateStyle()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::duplicateStyle ( Style $style,
string $range )

Duplicate cell style to a range of cells.

Please note that this will overwrite existing cell styles for cells in range!

Parameters
Style$styleCell style to duplicate
string$rangeRange of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
Return values
$this

◆ extractSheetTitle()

static PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::extractSheetTitle ( ?string $range,
bool $returnRange = false,
bool $unapostrophize = false )
static

Extract worksheet title from range.

Example: extractSheetTitle("testSheet!A1") ==> 'A1' Example: extractSheetTitle("testSheet!A1:C3") ==> 'A1:C3' Example: extractSheetTitle("'testSheet 1'!A1", true) ==> ['testSheet 1', 'A1']; Example: extractSheetTitle("'testSheet 1'!A1:C3", true) ==> ['testSheet 1', 'A1:C3']; Example: extractSheetTitle("A1", true) ==> ['', 'A1']; Example: extractSheetTitle("A1:C3", true) ==> ['', 'A1:C3']

Parameters
?string$rangeRange to extract title from
bool$returnRangeReturn range? (see example)
Return values
($rangeis non-empty-string ? ($returnRange is true ? array{0: string, 1: string} : string) : ($returnRange is true ? array{0: null, 1: null} : null))

◆ freezePane()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::freezePane ( null|CellAddress|string|array $coordinate,
null|CellAddress|string|array $topLeftCell = null,
bool $frozenSplit = false )

Freeze Pane.

Examples:

- A2 will freeze the rows above cell A2 (i.e row 1) - B1 will freeze the columns to the left of cell B1 (i.e column A) - B2 will freeze the rows above and to the left of cell B2 (i.e row 1 and column A)
Parameters
null|array{0int, 1: int}|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object. Passing a null value for this argument will clear any existing freeze pane for this worksheet.
null|array{0int, 1: int}|CellAddress|string $topLeftCell default position of the right bottom pane Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object.
Return values
$this

◆ fromArray()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::fromArray ( array $source,
mixed $nullValue = null,
string $startCell = 'A1',
bool $strictNullComparison = false )

Fill worksheet from values in array.

Parameters
array$sourceSource array
mixed$nullValueValue in source array that stands for blank cell
string$startCellInsert array starting from this cell address as the top left coordinate
bool$strictNullComparisonApply strict comparison when testing for null values in the array
Return values
$this

◆ garbageCollect()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::garbageCollect ( )

Run PhpSpreadsheet garbage collector.

Return values
$this

◆ getActiveCell()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getActiveCell ( )

Get active cell.

Return values
stringExample: 'A1'

◆ getBreaks()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getBreaks ( )

Get breaks.

Return values
int[]

◆ getCell()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getCell ( CellAddress|string|array $coordinate)

Get cell at a specific coordinate.

Parameters
array{0int, 1: int}|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object.
Return values
CellCell that was found or created WARNING: Because the cell collection can be cached to reduce memory, it only allows one "active" cell at a time in memory. If you assign that cell to a variable, then select another cell using getCell() or any of its variants, the newly selected cell becomes the "active" cell, and any previous assignment becomes a disconnected reference because the active cell has changed.

◆ getChartByIndex()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getChartByIndex ( ?string $index)

Get a chart by its index position.

Parameters
?string$indexChart index position
Return values
Chart|false

◆ getChartByName()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getChartByName ( string $chartName)

Get a chart by name.

Parameters
string$chartNameChart name
Return values
Chart|false

◆ getChartCollection()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getChartCollection ( )

Get collection of charts.

Return values
ArrayObject<int,Chart>

◆ getChartCount()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getChartCount ( )

Return the count of charts on this worksheet.

Return values
intThe number of charts

◆ getChartNames()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getChartNames ( )

Return an array of the names of charts on this worksheet.

Return values
string[]The names of charts

◆ getColumnBreaks()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getColumnBreaks ( )

Get column breaks.

Return values
PageBreak[]

◆ getColumnDimension()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getColumnDimension ( string $column)

Get column dimension at a specific column.

Parameters
string$columnString index of the column eg: 'A'

◆ getColumnDimensionByColumn()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getColumnDimensionByColumn ( int $columnIndex)

Get column dimension at a specific column by using numeric cell coordinates.

Parameters
int$columnIndexNumeric column coordinate of the cell

◆ getColumnDimensions()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getColumnDimensions ( )

Get collection of column dimensions.

Return values
ColumnDimension[]

◆ getColumnIterator()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getColumnIterator ( string $startColumn = 'A',
?string $endColumn = null )

Get column iterator.

Parameters
string$startColumnThe column address at which to start iterating
?string$endColumnThe column address at which to stop iterating

◆ getComment()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getComment ( CellAddress|string|array $cellCoordinate,
bool $attachNew = true )

Get comment for cell.

Parameters
array{0int, 1: int}|CellAddress|string $cellCoordinate Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object.

◆ getComments()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getComments ( )

Get comments.

Return values
Comment[]

◆ getConditionalStyles()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getConditionalStyles ( string $coordinate,
bool $firstOnly = true )

Get conditional styles for a cell.

Parameters
string$coordinateeg: 'A1' or 'A1:A3'. If a single cell is referenced, then the array of conditional styles will be returned if the cell is included in a conditional style range. If a range of cells is specified, then the styles will only be returned if the range matches the entire range of the conditional.
bool$firstOnlydefault true, return all matching conditionals ordered by priority if false, first only if true
Return values
Conditional[]

◆ getCoordinates()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getCoordinates ( bool $sorted = true)

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

Parameters
bool$sortedAlso sort the cell collection?
Return values
string[]

◆ getDataValidation()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getDataValidation ( string $cellCoordinate)

Get data validation.

Parameters
string$cellCoordinateCell coordinate to get data validation for, eg: 'A1'

◆ getDataValidationCollection()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getDataValidationCollection ( )

Get collection of data validations.

Return values
DataValidation[]

◆ getDrawingCollection()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getDrawingCollection ( )

Get collection of drawings.

Return values
ArrayObject<int,BaseDrawing>

◆ getHighestColumn()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getHighestColumn ( $row = null)

Get highest worksheet column.

Parameters
null | int | string$rowReturn the data highest column for the specified row, or the highest column of any row if no row number is passed
Return values
stringHighest column name

◆ getHighestDataColumn()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getHighestDataColumn ( $row = null)

Get highest worksheet column that contains data.

Parameters
null | int | string$rowReturn the highest data column for the specified row, or the highest data column of any row if no row number is passed
Return values
stringHighest column name that contains data

◆ getHighestDataRow()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getHighestDataRow ( ?string $column = null)

Get highest worksheet row that contains data.

Parameters
null | string$columnReturn the highest data row for the specified column, or the highest data row of any column if no column letter is passed
Return values
intHighest row number that contains data

◆ getHighestRow()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getHighestRow ( ?string $column = null)

Get highest worksheet row.

Parameters
null | string$columnReturn the highest data row for the specified column, or the highest row of any column if no column letter is passed
Return values
intHighest row number

◆ getHighestRowAndColumn()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getHighestRowAndColumn ( )

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

Return values
arrayHighest column name and highest row number

◆ getHyperlink()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getHyperlink ( string $cellCoordinate)

Get hyperlink.

Parameters
string$cellCoordinateCell coordinate to get hyperlink for, eg: 'A1'

◆ getHyperlinkCollection()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getHyperlinkCollection ( )

Get collection of hyperlinks.

Return values
Hyperlink[]

◆ getMergeCells()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getMergeCells ( )

Get merge cells array.

Return values
string[]

◆ getPanes()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getPanes ( )
Return values
(null|Pane)[]

◆ getProtectedCellRanges()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getProtectedCellRanges ( )

Get protected cells.

Return values
ProtectedRange[]

◆ getRowBreaks()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getRowBreaks ( )

Get row breaks.

Return values
PageBreak[]

◆ getRowDimension()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getRowDimension ( int $row)

Get row dimension at a specific row.

Parameters
int$rowNumeric index of the row

◆ getRowDimensions()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getRowDimensions ( )

Get collection of row dimensions.

Return values
RowDimension[]

◆ getRowIterator()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getRowIterator ( int $startRow = 1,
?int $endRow = null )

Get row iterator.

Parameters
int$startRowThe row number at which to start iterating
?int$endRowThe row number at which to stop iterating

◆ getSheetState()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getSheetState ( )

Get sheet state.

Return values
stringSheet state (visible, hidden, veryHidden)

◆ getShowSummaryBelow()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getShowSummaryBelow ( )

Show summary below?

(Row/Column outlining).

◆ getShowSummaryRight()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getShowSummaryRight ( )

Show summary right?

(Row/Column outlining).

◆ getStyle()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getStyle ( AddressRange|CellAddress|int|string|array $cellCoordinate)

Get style for cell.

Parameters
AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $cellCoordinate A simple string containing a cell address like 'A1' or a cell range like 'A1:E10' or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), or a CellAddress or AddressRange object.

◆ getTableByName()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getTableByName ( string $name)
Parameters
string$namethe table name to search
Return values
null|TableThe table from the tables collection, or null if not found

◆ getTableCollection()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getTableCollection ( )

Get collection of Tables.

Return values
ArrayObject<int,Table>

◆ getTableIndexByName()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getTableIndexByName ( string $name)
protected
Parameters
string$namethe table name to search
Return values
null|intThe index of the located table in the tables collection, or null if not found

◆ getTableNames()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getTableNames ( )
Return values
string[]array of Table names

◆ hyperlinkExists()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::hyperlinkExists ( string $coordinate)

Hyperlink at a specific coordinate exists?

Parameters
string$coordinateeg: 'A1'

◆ insertNewColumnBefore()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::insertNewColumnBefore ( string $before,
int $numberOfColumns = 1 )

Insert a new column, updating all possible related data.

Parameters
string$beforeInsert before this column Name, eg: 'A'
int$numberOfColumnsNumber of new columns to insert
Return values
$this

◆ insertNewColumnBeforeByIndex()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::insertNewColumnBeforeByIndex ( int $beforeColumnIndex,
int $numberOfColumns = 1 )

Insert a new column, updating all possible related data.

Parameters
int$beforeColumnIndexInsert before this column ID (numeric column coordinate of the cell)
int$numberOfColumnsNumber of new columns to insert
Return values
$this

◆ insertNewRowBefore()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::insertNewRowBefore ( int $before,
int $numberOfRows = 1 )

Insert a new row, updating all possible related data.

Parameters
int$beforeInsert before this row number
int$numberOfRowsNumber of new rows to insert
Return values
$this

◆ isEmptyColumn()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::isEmptyColumn ( string $columnId,
int $definitionOfEmptyFlags = 0 )

Returns a boolean true if the specified column contains no cells.

By default, this means that no cell records exist in the collection for this column. false will be returned otherwise. This rule can be modified by passing a $definitionOfEmptyFlags value: 1 - CellIterator::TREAT_NULL_VALUE_AS_EMPTY_CELL If the only cells in the collection are null value cells, then the column will be considered empty. 2 - CellIterator::TREAT_EMPTY_STRING_AS_EMPTY_CELL If the only cells in the collection are empty string value cells, then the column will be considered empty. 3 - CellIterator::TREAT_NULL_VALUE_AS_EMPTY_CELL | CellIterator::TREAT_EMPTY_STRING_AS_EMPTY_CELL If the only cells in the collection are null value or empty string value cells, then the column will be considered empty.

Parameters
int$definitionOfEmptyFlagsPossible Flag Values are: CellIterator::TREAT_NULL_VALUE_AS_EMPTY_CELL CellIterator::TREAT_EMPTY_STRING_AS_EMPTY_CELL

◆ isEmptyRow()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::isEmptyRow ( int $rowId,
int $definitionOfEmptyFlags = 0 )

Returns a boolean true if the specified row contains no cells.

By default, this means that no cell records exist in the collection for this row. false will be returned otherwise. This rule can be modified by passing a $definitionOfEmptyFlags value: 1 - CellIterator::TREAT_NULL_VALUE_AS_EMPTY_CELL If the only cells in the collection are null value cells, then the row will be considered empty. 2 - CellIterator::TREAT_EMPTY_STRING_AS_EMPTY_CELL If the only cells in the collection are empty string value cells, then the row will be considered empty. 3 - CellIterator::TREAT_NULL_VALUE_AS_EMPTY_CELL | CellIterator::TREAT_EMPTY_STRING_AS_EMPTY_CELL If the only cells in the collection are null value or empty string value cells, then the row will be considered empty.

Parameters
int$definitionOfEmptyFlagsPossible Flag Values are: CellIterator::TREAT_NULL_VALUE_AS_EMPTY_CELL CellIterator::TREAT_EMPTY_STRING_AS_EMPTY_CELL

◆ mergeCells()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::mergeCells ( AddressRange|string|array $range,
string $behaviour = self::MERGE_CELL_CONTENT_EMPTY )

Set merge on a cell range.

Parameters
AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range A simple string containing a Cell range like 'A1:E10' or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), or an AddressRange.
string$behaviourHow the merged cells should behave. Possible values are: MERGE_CELL_CONTENT_EMPTY - Empty the content of the hidden cells MERGE_CELL_CONTENT_HIDE - Keep the content of the hidden cells MERGE_CELL_CONTENT_MERGE - Move the content of the hidden cells into the first cell
Return values
$this

◆ namedRangeToArray()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::namedRangeToArray ( string $definedName,
mixed $nullValue = null,
bool $calculateFormulas = true,
bool $formatData = true,
bool $returnCellRef = false,
bool $ignoreHidden = false,
bool $reduceArrays = false )

Create array from a range of cells.

Parameters
string$definedNameThe Named Range that should be returned
null | bool | float | int | RichText | string$nullValueValue returned in the array entry if a cell doesn't exist
bool$calculateFormulasShould formulas be calculated?
bool$formatDataShould formatting be applied to cell values?
bool$returnCellRefFalse - Return a simple array of rows and columns indexed by number counting from zero True - Return rows and columns indexed by their actual row and column IDs
bool$ignoreHiddenFalse - Return values for rows/columns even if they are defined as hidden. True - Don't return values for rows/columns that are defined as hidden.

◆ protectCells()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::protectCells ( AddressRange|CellAddress|int|string|array $range,
string $password = '',
bool $alreadyHashed = false,
string $name = '',
string $securityDescriptor = '' )

Set protection on a cell or cell range.

Parameters
AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $range A simple string containing a Cell range like 'A1:E10' or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), or a CellAddress or AddressRange object.
string$passwordPassword to unlock the protection
bool$alreadyHashedIf the password has already been hashed, set this to true
Return values
$this

◆ rangeToArray()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::rangeToArray ( string $range,
mixed $nullValue = null,
bool $calculateFormulas = true,
bool $formatData = true,
bool $returnCellRef = false,
bool $ignoreHidden = false,
bool $reduceArrays = false )

Create array from a range of cells.

Parameters
null | bool | float | int | RichText | string$nullValueValue returned in the array entry if a cell doesn't exist
bool$calculateFormulasShould formulas be calculated?
bool$formatDataShould formatting be applied to cell values?
bool$returnCellRefFalse - Return a simple array of rows and columns indexed by number counting from zero True - Return rows and columns indexed by their actual row and column IDs
bool$ignoreHiddenFalse - Return values for rows/columns even if they are defined as hidden. True - Don't return values for rows/columns that are defined as hidden.

◆ rangeToArrayYieldRows()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::rangeToArrayYieldRows ( string $range,
mixed $nullValue = null,
bool $calculateFormulas = true,
bool $formatData = true,
bool $returnCellRef = false,
bool $ignoreHidden = false,
bool $reduceArrays = false )

Create array from a range of cells, yielding each row in turn.

Parameters
null | bool | float | int | RichText | string$nullValueValue returned in the array entry if a cell doesn't exist
bool$calculateFormulasShould formulas be calculated?
bool$formatDataShould formatting be applied to cell values?
bool$returnCellRefFalse - Return a simple array of rows and columns indexed by number counting from zero True - Return rows and columns indexed by their actual row and column IDs
bool$ignoreHiddenFalse - Return values for rows/columns even if they are defined as hidden. True - Don't return values for rows/columns that are defined as hidden.
Return values
Generator<array>

◆ rebindParent()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::rebindParent ( Spreadsheet $parent)

Re-bind parent.

Return values
$this

◆ refreshColumnDimensions()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::refreshColumnDimensions ( )

Refresh column dimensions.

Return values
$this

◆ refreshRowDimensions()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::refreshRowDimensions ( )

Refresh row dimensions.

Return values
$this

◆ removeColumn()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::removeColumn ( string $column,
int $numberOfColumns = 1 )

Remove a column, updating all possible related data.

Parameters
string$columnRemove columns starting with this column name, eg: 'A'
int$numberOfColumnsNumber of columns to remove
Return values
$this

◆ removeColumnByIndex()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::removeColumnByIndex ( int $columnIndex,
int $numColumns = 1 )

Remove a column, updating all possible related data.

Parameters
int$columnIndexRemove starting with this column Index (numeric column coordinate)
int$numColumnsNumber of columns to remove
Return values
$this

◆ removeComment()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::removeComment ( CellAddress|string|array $cellCoordinate)

Remove comment from cell.

Parameters
array{0int, 1: int}|CellAddress|string $cellCoordinate Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object.
Return values
$this

◆ removeConditionalStyles()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::removeConditionalStyles ( string $coordinate)

Removes conditional styles for a cell.

Parameters
string$coordinateeg: 'A1'
Return values
$this

◆ removeRow()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::removeRow ( int $row,
int $numberOfRows = 1 )

Delete a row, updating all possible related data.

Parameters
int$rowRemove rows, starting with this row number
int$numberOfRowsNumber of rows to remove
Return values
$this

◆ removeTableByName()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::removeTableByName ( string $name)

Remove Table by name.

Parameters
string$nameTable name
Return values
$this

◆ resetTabColor()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::resetTabColor ( )

Reset tab color.

Return values
$this

◆ setAutoFilter()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setAutoFilter ( AddressRange|string|array|AutoFilter $autoFilterOrRange)

Set AutoFilter.

Parameters
AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|AutoFilter|string $autoFilterOrRange A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), or an AddressRange.
Return values
$this

◆ setBackgroundImage()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setBackgroundImage ( string $backgroundImage)

Set background image.

Used on read/write for Xlsx. Used on write for Html.

Parameters
string$backgroundImageImage represented as a string, e.g. results of file_get_contents

◆ setBreak()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setBreak ( CellAddress|string|array $coordinate,
int $break,
int $max = -1 )

Set break on a cell.

Parameters
array{0int, 1: int}|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object.
int$breakBreak type (type of Worksheet::BREAK_*)
Return values
$this

◆ setCellValue()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setCellValue ( CellAddress|string|array $coordinate,
mixed $value,
?IValueBinder $binder = null )

Set a cell value.

Parameters
array{0int, 1: int}|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object.
mixed$valueValue for the cell
null | IValueBinder$binderValue Binder to override the currently set Value Binder
Return values
$this

◆ setCellValueExplicit()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setCellValueExplicit ( CellAddress|string|array $coordinate,
mixed $value,
string $dataType )

Set a cell value.

Parameters
array{0int, 1: int}|CellAddress|string $coordinate Coordinate of the cell as a string, eg: 'C5'; or as an array of [$columnIndex, $row] (e.g. [3, 5]), or a CellAddress object.
mixed$valueValue of the cell
string$dataTypeExplicit data type, see DataType::TYPE_* Note that PhpSpreadsheet does not validate that the value and datatype are consistent, in using this method, then it is your responsibility as an end-user developer to validate that the value and the datatype match. If you do mismatch value and datatpe, then the value you enter may be changed to match the datatype that you specify.
See also
DataType
Return values
$this

◆ setCodeName()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setCodeName ( string $codeName,
bool $validate = true )

Define the code name of the sheet.

Parameters
string$codeNameSame rule as Title minus space not allowed (but, like Excel, change silently space to underscore)
bool$validateFalse to skip validation of new title. WARNING: This should only be set at parse time (by Readers), where titles can be assumed to be valid.
Return values
$this

◆ setComments()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setComments ( array $comments)

Set comments array for the entire sheet.

Parameters
Comment[]$comments
Return values
$this

◆ setConditionalStyles()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setConditionalStyles ( string $coordinate,
array $styles )

Set conditional styles.

Parameters
string$coordinateeg: 'A1'
Conditional[]$styles
Return values
$this

◆ setDataValidation()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setDataValidation ( string $cellCoordinate,
?DataValidation $dataValidation = null )

Set data validation.

Parameters
string$cellCoordinateCell coordinate to insert data validation, eg: 'A1'
Return values
$this

◆ setHeaderFooter()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setHeaderFooter ( HeaderFooter $headerFooter)

Set page header/footer.

Return values
$this

◆ setHyperlink()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setHyperlink ( string $cellCoordinate,
?Hyperlink $hyperlink = null )

Set hyperlink.

Parameters
string$cellCoordinateCell coordinate to insert hyperlink, eg: 'A1'
Return values
$this

◆ setMergeCells()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setMergeCells ( array $mergeCells)

Set merge cells array for the entire sheet.

Use instead mergeCells() to merge a single cell range.

Parameters
string[]$mergeCells
Return values
$this

◆ setPageMargins()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setPageMargins ( PageMargins $pageMargins)

Set page margins.

Return values
$this

◆ setPageSetup()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setPageSetup ( PageSetup $pageSetup)

Set page setup.

Return values
$this

◆ setPrintGridlines()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setPrintGridlines ( bool $printGridLines)

Set print gridlines.

Parameters
bool$printGridLinesPrint gridlines (true/false)
Return values
$this

◆ setProtection()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setProtection ( Protection $protection)

Set Protection.

Return values
$this

◆ setRightToLeft()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setRightToLeft ( bool $value)

Set right-to-left.

Parameters
bool$valueRight-to-left true/false
Return values
$this

◆ setSelectedCell()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setSelectedCell ( string $coordinate)

Selected cell.

Parameters
string$coordinateCell (i.e. A1)
Return values
$this

◆ setSelectedCells()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setSelectedCells ( AddressRange|CellAddress|int|string|array $coordinate)

Select a range of cells.

Parameters
AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $coordinate A simple string containing a Cell range like 'A1:E10' or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), or a CellAddress or AddressRange object.
Return values
$this

◆ setSheetState()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setSheetState ( string $value)

Set sheet state.

Parameters
string$valueSheet state (visible, hidden, veryHidden)
Return values
$this

◆ setSheetView()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setSheetView ( SheetView $sheetView)

Set sheet view.

Return values
$this

◆ setShowGridlines()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setShowGridlines ( bool $showGridLines)

Set show gridlines.

Parameters
bool$showGridLinesShow gridlines (true/false)
Return values
$this

◆ setShowRowColHeaders()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setShowRowColHeaders ( bool $showRowColHeaders)

Set show row and column headers.

Parameters
bool$showRowColHeadersShow row and column headers (true/false)
Return values
$this

◆ setShowSummaryBelow()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setShowSummaryBelow ( bool $showSummaryBelow)

Set show summary below.

Parameters
bool$showSummaryBelowShow summary below (true/false)
Return values
$this

◆ setShowSummaryRight()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setShowSummaryRight ( bool $showSummaryRight)

Set show summary right.

Parameters
bool$showSummaryRightShow summary right (true/false)
Return values
$this

◆ setTitle()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::setTitle ( string $title,
bool $updateFormulaCellReferences = true,
bool $validate = true )

Set title.

Parameters
string$titleString containing the dimension of this worksheet
bool$updateFormulaCellReferencesFlag indicating whether cell references in formulae should be updated to reflect the new sheet name. This should be left as the default true, unless you are certain that no formula cells on any worksheet contain references to this worksheet
bool$validateFalse to skip validation of new title. WARNING: This should only be set at parse time (by Readers), where titles can be assumed to be valid.
Return values
$this

◆ shrinkRangeToFit()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::shrinkRangeToFit ( string $range)

Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet.

Return values
stringAdjusted range value

◆ toArray()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::toArray ( mixed $nullValue = null,
bool $calculateFormulas = true,
bool $formatData = true,
bool $returnCellRef = false,
bool $ignoreHidden = false,
bool $reduceArrays = false )

Create array from worksheet.

Parameters
null | bool | float | int | RichText | string$nullValueValue returned in the array entry if a cell doesn't exist
bool$calculateFormulasShould formulas be calculated?
bool$formatDataShould formatting be applied to cell values?
bool$returnCellRefFalse - Return a simple array of rows and columns indexed by number counting from zero True - Return rows and columns indexed by their actual row and column IDs
bool$ignoreHiddenFalse - Return values for rows/columns even if they are defined as hidden. True - Don't return values for rows/columns that are defined as hidden.

◆ unfreezePane()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::unfreezePane ( )

Unfreeze Pane.

Return values
$this

◆ unmergeCells()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::unmergeCells ( AddressRange|string|array $range)

Remove merge on a cell range.

Parameters
AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|string $range A simple string containing a Cell range like 'A1:E10' or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), or an AddressRange.
Return values
$this

◆ unprotectCells()

PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::unprotectCells ( AddressRange|CellAddress|int|string|array $range)

Remove protection on a cell or cell range.

Parameters
AddressRange<CellAddress>|AddressRange<int>|AddressRange<string>|array{0int, 1: int, 2: int, 3: int}|array{0: int, 1: int}|CellAddress|int|string $range A simple string containing a Cell range like 'A1:E10' or passing in an array of [$fromColumnIndex, $fromRow, $toColumnIndex, $toRow] (e.g. [3, 5, 6, 8]), or a CellAddress or AddressRange object.
Return values
$this

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