\PHPExcel_Worksheet

PHPExcel_Worksheet

Summary

Methods
Properties
Constants
__construct()
disconnectCells()
__destruct()
getCellCacheController()
getInvalidCharacters()
getCellCollection()
sortCellCollection()
getRowDimensions()
getDefaultRowDimension()
getColumnDimensions()
getDefaultColumnDimension()
getDrawingCollection()
getChartCollection()
addChart()
getChartCount()
getChartByIndex()
getChartNames()
getChartByName()
refreshColumnDimensions()
refreshRowDimensions()
calculateWorksheetDimension()
calculateWorksheetDataDimension()
calculateColumnWidths()
getParent()
rebindParent()
getTitle()
setTitle()
getSheetState()
setSheetState()
getPageSetup()
setPageSetup()
getPageMargins()
setPageMargins()
getHeaderFooter()
setHeaderFooter()
getSheetView()
setSheetView()
getProtection()
setProtection()
getHighestColumn()
getHighestDataColumn()
getHighestRow()
getHighestDataRow()
getHighestRowAndColumn()
setCellValue()
setCellValueByColumnAndRow()
setCellValueExplicit()
setCellValueExplicitByColumnAndRow()
getCell()
getCellByColumnAndRow()
cellExists()
cellExistsByColumnAndRow()
getRowDimension()
getColumnDimension()
getColumnDimensionByColumn()
getStyles()
getDefaultStyle()
setDefaultStyle()
getStyle()
getConditionalStyles()
conditionalStylesExists()
removeConditionalStyles()
getConditionalStylesCollection()
setConditionalStyles()
getStyleByColumnAndRow()
setSharedStyle()
duplicateStyle()
duplicateConditionalStyle()
duplicateStyleArray()
setBreak()
setBreakByColumnAndRow()
getBreaks()
mergeCells()
mergeCellsByColumnAndRow()
unmergeCells()
unmergeCellsByColumnAndRow()
getMergeCells()
setMergeCells()
protectCells()
protectCellsByColumnAndRow()
unprotectCells()
unprotectCellsByColumnAndRow()
getProtectedCells()
getAutoFilter()
setAutoFilter()
setAutoFilterByColumnAndRow()
removeAutoFilter()
getFreezePane()
freezePane()
freezePaneByColumnAndRow()
unfreezePane()
insertNewRowBefore()
insertNewColumnBefore()
insertNewColumnBeforeByIndex()
removeRow()
removeColumn()
removeColumnByIndex()
getShowGridlines()
setShowGridlines()
getPrintGridlines()
setPrintGridlines()
getShowRowColHeaders()
setShowRowColHeaders()
getShowSummaryBelow()
setShowSummaryBelow()
getShowSummaryRight()
setShowSummaryRight()
getComments()
setComments()
getComment()
getCommentByColumnAndRow()
getSelectedCell()
getActiveCell()
getSelectedCells()
setSelectedCell()
setSelectedCells()
setSelectedCellByColumnAndRow()
getRightToLeft()
setRightToLeft()
fromArray()
rangeToArray()
namedRangeToArray()
toArray()
getRowIterator()
garbageCollect()
getHashCode()
extractSheetTitle()
getHyperlink()
setHyperlink()
hyperlinkExists()
getHyperlinkCollection()
getDataValidation()
setDataValidation()
dataValidationExists()
getDataValidationCollection()
shrinkRangeToFit()
getTabColor()
resetTabColor()
isTabColorSet()
copy()
__clone()
setCodeName()
getCodeName()
hasCodeName()
No public properties found
BREAK_NONE
BREAK_ROW
BREAK_COLUMN
SHEETSTATE_VISIBLE
SHEETSTATE_HIDDEN
SHEETSTATE_VERYHIDDEN
No protected methods found
No protected properties found
N/A
_checkSheetCodeName()
_checkSheetTitle()
_createNewCell()
$_invalidCharacters
$_parent
$_cellCollection
$_rowDimensions
$_defaultRowDimension
$_columnDimensions
$_defaultColumnDimension
$_drawingCollection
$_chartCollection
$_title
$_sheetState
$_pageSetup
$_pageMargins
$_headerFooter
$_sheetView
$_protection
$_styles
$_conditionalStylesCollection
$_cellCollectionIsSorted
$_breaks
$_mergeCells
$_protectedCells
$_autoFilter
$_freezePane
$_showGridlines
$_printGridlines
$_showRowColHeaders
$_showSummaryBelow
$_showSummaryRight
$_comments
$_activeCell
$_selectedCells
$_cachedHighestColumn
$_cachedHighestRow
$_rightToLeft
$_hyperlinkCollection
$_dataValidationCollection
$_tabColor
$_dirty
$_hash
$_codeName
N/A

Constants

BREAK_NONE

BREAK_NONE = 0

BREAK_ROW

BREAK_ROW = 1

BREAK_COLUMN

BREAK_COLUMN = 2

SHEETSTATE_VISIBLE

SHEETSTATE_VISIBLE = 'visible'

SHEETSTATE_HIDDEN

SHEETSTATE_HIDDEN = 'hidden'

SHEETSTATE_VERYHIDDEN

SHEETSTATE_VERYHIDDEN = 'veryHidden'

Properties

$_invalidCharacters

$_invalidCharacters : array

Invalid characters in sheet title

Type

array

$_parent

$_parent : \PHPExcel

Parent spreadsheet

Type

PHPExcel

$_cellCollection

$_cellCollection : \PHPExcel_CachedObjectStorage_xxx

Cacheable collection of cells

Type

\PHPExcel_CachedObjectStorage_xxx —

$_chartCollection

$_chartCollection : \PHPExcel_Chart[]

Collection of Chart objects

Type

PHPExcel_Chart[]

$_title

$_title : string

Worksheet title

Type

string

$_sheetState

$_sheetState : string

Sheet state

Type

string

$_pageSetup

$_pageSetup : \PHPExcel_Worksheet_PageSetup

Page setup

Type

\PHPExcel_Worksheet_PageSetup —

$_styles

$_styles : \PHPExcel_Style[]

Collection of styles

Type

PHPExcel_Style[]

$_conditionalStylesCollection

$_conditionalStylesCollection : array

Conditional styles. Indexed by cell coordinate, e.g. 'A1'

Type

array

$_cellCollectionIsSorted

$_cellCollectionIsSorted : bool

Is the current cell collection sorted already?

Type

bool

$_breaks

$_breaks : array

Collection of breaks

Type

array

$_mergeCells

$_mergeCells : array

Collection of merged cell ranges

Type

array

$_protectedCells

$_protectedCells : array

Collection of protected cell ranges

Type

array

$_freezePane

$_freezePane : string

Freeze pane

Type

string

$_showGridlines

$_showGridlines : bool

Show gridlines?

Type

bool

$_printGridlines

$_printGridlines : bool

Print gridlines?

Type

bool

$_showRowColHeaders

$_showRowColHeaders : bool

Show row and column headers?

Type

bool

$_showSummaryBelow

$_showSummaryBelow : bool

Show summary below? (Row/Column outline)

Type

bool

$_showSummaryRight

$_showSummaryRight : bool

Show summary right? (Row/Column outline)

Type

bool

$_comments

$_comments : \PHPExcel_Comment[]

Collection of comments

Type

PHPExcel_Comment[]

$_activeCell

$_activeCell : string

Active cell. (Only one!)

Type

string

$_selectedCells

$_selectedCells : string

Selected cells

Type

string

$_cachedHighestColumn

$_cachedHighestColumn : string

Cached highest column

Type

string

$_cachedHighestRow

$_cachedHighestRow : int

Cached highest row

Type

int

$_rightToLeft

$_rightToLeft : bool

Right-to-left?

Type

bool

$_hyperlinkCollection

$_hyperlinkCollection : array

Hyperlinks. Indexed by cell coordinate, e.g. 'A1'

Type

array

$_dataValidationCollection

$_dataValidationCollection : array

Data validation objects. Indexed by cell coordinate, e.g. 'A1'

Type

array

$_dirty

$_dirty : bool

Dirty flag

Type

bool

$_hash

$_hash : string

Hash

Type

string

$_codeName

$_codeName : string

CodeName

Type

string

Methods

__construct()

__construct(\PHPExcel  $pParent = null, string  $pTitle = 'Worksheet') : mixed

Create a new worksheet

Parameters

\PHPExcel $pParent
string $pTitle

Returns

mixed —

disconnectCells()

disconnectCells() : mixed

Disconnect all cells from this PHPExcel_Worksheet object, typically so that the worksheet object can be unset

Returns

mixed —

__destruct()

__destruct() : mixed

Code to execute when this worksheet is unset()

Returns

mixed —

getCellCacheController()

getCellCacheController() : \PHPExcel_CachedObjectStorage_xxx

Return the cache controller for the cell collection

Returns

\PHPExcel_CachedObjectStorage_xxx —

getInvalidCharacters()

getInvalidCharacters() : array

Get array of invalid characters for sheet title

Returns

array —

getCellCollection()

getCellCollection(bool  $pSorted = true) : \PHPExcel_Cell[]

Get collection of cells

Parameters

bool $pSorted

Also sort the cell collection?

Returns

\PHPExcel_Cell[] —

sortCellCollection()

sortCellCollection() : \PHPExcel_Worksheet

Sort collection of cells

Returns

\PHPExcel_Worksheet —

getRowDimensions()

getRowDimensions() : \PHPExcel_Worksheet_RowDimension[]

Get collection of row dimensions

Returns

\PHPExcel_Worksheet_RowDimension[] —

getDefaultRowDimension()

getDefaultRowDimension() : \PHPExcel_Worksheet_RowDimension

Get default row dimension

Returns

\PHPExcel_Worksheet_RowDimension —

getColumnDimensions()

getColumnDimensions() : \PHPExcel_Worksheet_ColumnDimension[]

Get collection of column dimensions

Returns

\PHPExcel_Worksheet_ColumnDimension[] —

getDefaultColumnDimension()

getDefaultColumnDimension() : \PHPExcel_Worksheet_ColumnDimension

Get default column dimension

Returns

\PHPExcel_Worksheet_ColumnDimension —

getDrawingCollection()

getDrawingCollection() : \PHPExcel_Worksheet_BaseDrawing[]

Get collection of drawings

Returns

\PHPExcel_Worksheet_BaseDrawing[] —

getChartCollection()

getChartCollection() : \PHPExcel_Chart[]

Get collection of charts

Returns

\PHPExcel_Chart[] —

addChart()

addChart(\PHPExcel_Chart  $pChart = null, int|null  $iChartIndex = null) : \PHPExcel_Chart

Add chart

Parameters

\PHPExcel_Chart $pChart
int|null $iChartIndex

Index where chart should go (0,1,..., or null for last)

Returns

\PHPExcel_Chart —

getChartCount()

getChartCount() : int

Return the count of charts on this worksheet

Returns

int —

The number of charts

getChartByIndex()

getChartByIndex(string  $index = null) : false|\PHPExcel_Chart

Get a chart by its index position

Parameters

string $index

Chart index position

Throws

\PHPExcel_Exception

Returns

false|\PHPExcel_Chart —

getChartNames()

getChartNames() : string[]

Return an array of the names of charts on this worksheet

Throws

\PHPExcel_Exception

Returns

string[] —

The names of charts

getChartByName()

getChartByName(string  $chartName = '') : false|\PHPExcel_Chart

Get a chart by name

Parameters

string $chartName

Chart name

Throws

\PHPExcel_Exception

Returns

false|\PHPExcel_Chart —

refreshColumnDimensions()

refreshColumnDimensions() : \PHPExcel_Worksheet

Refresh column dimensions

Returns

\PHPExcel_Worksheet —

refreshRowDimensions()

refreshRowDimensions() : \PHPExcel_Worksheet

Refresh row dimensions

Returns

\PHPExcel_Worksheet —

calculateWorksheetDimension()

calculateWorksheetDimension() : string

Calculate worksheet dimension

Returns

string —

String containing the dimension of this worksheet

calculateWorksheetDataDimension()

calculateWorksheetDataDimension() : string

Calculate worksheet data dimension

Returns

string —

String containing the dimension of this worksheet that actually contain data

calculateColumnWidths()

calculateColumnWidths(bool  $calculateMergeCells = false) : mixed

Calculate widths for auto-size columns

Parameters

bool $calculateMergeCells

Calculate merge cell width

Returns

mixed —

getParent()

getParent() : \PHPExcel

Get parent

Returns

\PHPExcel —

rebindParent()

rebindParent(\PHPExcel  $parent) : \PHPExcel_Worksheet

Re-bind parent

Parameters

\PHPExcel $parent

Returns

\PHPExcel_Worksheet —

getTitle()

getTitle() : string

Get title

Returns

string —

setTitle()

setTitle(string  $pValue = 'Worksheet', string  $updateFormulaCellReferences = true) : \PHPExcel_Worksheet

Set title

Parameters

string $pValue

String containing the dimension of this worksheet

string $updateFormulaCellReferences

boolean Flag 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

Returns

\PHPExcel_Worksheet —

getSheetState()

getSheetState() : string

Get sheet state

Returns

string —

Sheet state (visible, hidden, veryHidden)

setSheetState()

setSheetState(string  $value = PHPExcel_Worksheet::SHEETSTATE_VISIBLE) : \PHPExcel_Worksheet

Set sheet state

Parameters

string $value

Sheet state (visible, hidden, veryHidden)

Returns

\PHPExcel_Worksheet —

getPageSetup()

getPageSetup() : \PHPExcel_Worksheet_PageSetup

Get page setup

Returns

\PHPExcel_Worksheet_PageSetup —

setPageSetup()

setPageSetup(\PHPExcel_Worksheet_PageSetup  $pValue) : \PHPExcel_Worksheet

Set page setup

Parameters

\PHPExcel_Worksheet_PageSetup $pValue

Returns

\PHPExcel_Worksheet —

getPageMargins()

getPageMargins() : \PHPExcel_Worksheet_PageMargins

Get page margins

Returns

\PHPExcel_Worksheet_PageMargins —

setPageMargins()

setPageMargins(\PHPExcel_Worksheet_PageMargins  $pValue) : \PHPExcel_Worksheet

Set page margins

Parameters

\PHPExcel_Worksheet_PageMargins $pValue

Returns

\PHPExcel_Worksheet —

getHeaderFooter()

getHeaderFooter() : \PHPExcel_Worksheet_HeaderFooter

Get page header/footer

Returns

\PHPExcel_Worksheet_HeaderFooter —

setHeaderFooter()

setHeaderFooter(\PHPExcel_Worksheet_HeaderFooter  $pValue) : \PHPExcel_Worksheet

Set page header/footer

Parameters

\PHPExcel_Worksheet_HeaderFooter $pValue

Returns

\PHPExcel_Worksheet —

getSheetView()

getSheetView() : \PHPExcel_Worksheet_SheetView

Get sheet view

Returns

\PHPExcel_Worksheet_SheetView —

setSheetView()

setSheetView(\PHPExcel_Worksheet_SheetView  $pValue) : \PHPExcel_Worksheet

Set sheet view

Parameters

\PHPExcel_Worksheet_SheetView $pValue

Returns

\PHPExcel_Worksheet —

getProtection()

getProtection() : \PHPExcel_Worksheet_Protection

Get Protection

Returns

\PHPExcel_Worksheet_Protection —

setProtection()

setProtection(\PHPExcel_Worksheet_Protection  $pValue) : \PHPExcel_Worksheet

Set Protection

Parameters

\PHPExcel_Worksheet_Protection $pValue

Returns

\PHPExcel_Worksheet —

getHighestColumn()

getHighestColumn(string  $row = null) : string

Get highest worksheet column

Parameters

string $row

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

Returns

string —

Highest column name

getHighestDataColumn()

getHighestDataColumn(string  $row = null) : string

Get highest worksheet column that contains data

Parameters

string $row

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

Returns

string —

Highest column name that contains data

getHighestRow()

getHighestRow(string  $column = null) : int

Get highest worksheet row

Parameters

string $column

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

Returns

int —

Highest row number

getHighestDataRow()

getHighestDataRow(string  $column = null) : string

Get highest worksheet row that contains data

Parameters

string $column

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

Returns

string —

Highest row number that contains data

getHighestRowAndColumn()

getHighestRowAndColumn() : array

Get highest worksheet column and highest row that have cell records

Returns

array —

Highest column name and highest row number

setCellValue()

setCellValue(string  $pCoordinate = 'A1', mixed  $pValue = null, bool  $returnCell = false) : \PHPExcel_Worksheet|\PHPExcel_Cell

Set a cell value

Parameters

string $pCoordinate

Coordinate of the cell

mixed $pValue

Value of the cell

bool $returnCell

Return the worksheet (false, default) or the cell (true)

Returns

\PHPExcel_Worksheet|\PHPExcel_Cell —

Depending on the last parameter being specified

setCellValueByColumnAndRow()

setCellValueByColumnAndRow(string  $pColumn, string  $pRow = 1, mixed  $pValue = null, bool  $returnCell = false) : \PHPExcel_Worksheet|\PHPExcel_Cell

Set a cell value by using numeric cell coordinates

Parameters

string $pColumn

Numeric column coordinate of the cell (A = 0)

string $pRow

Numeric row coordinate of the cell

mixed $pValue

Value of the cell

bool $returnCell

Return the worksheet (false, default) or the cell (true)

Returns

\PHPExcel_Worksheet|\PHPExcel_Cell —

Depending on the last parameter being specified

setCellValueExplicit()

setCellValueExplicit(string  $pCoordinate = 'A1', mixed  $pValue = null, string  $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, bool  $returnCell = false) : \PHPExcel_Worksheet|\PHPExcel_Cell

Set a cell value

Parameters

string $pCoordinate

Coordinate of the cell

mixed $pValue

Value of the cell

string $pDataType

Explicit data type

bool $returnCell

Return the worksheet (false, default) or the cell (true)

Returns

\PHPExcel_Worksheet|\PHPExcel_Cell —

Depending on the last parameter being specified

setCellValueExplicitByColumnAndRow()

setCellValueExplicitByColumnAndRow(string  $pColumn, string  $pRow = 1, mixed  $pValue = null, string  $pDataType = PHPExcel_Cell_DataType::TYPE_STRING, bool  $returnCell = false) : \PHPExcel_Worksheet|\PHPExcel_Cell

Set a cell value by using numeric cell coordinates

Parameters

string $pColumn

Numeric column coordinate of the cell

string $pRow

Numeric row coordinate of the cell

mixed $pValue

Value of the cell

string $pDataType

Explicit data type

bool $returnCell

Return the worksheet (false, default) or the cell (true)

Returns

\PHPExcel_Worksheet|\PHPExcel_Cell —

Depending on the last parameter being specified

getCell()

getCell(string  $pCoordinate = 'A1') : \PHPExcel_Cell

Get cell at a specific coordinate

Parameters

string $pCoordinate

Coordinate of the cell

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Cell —

Cell that was found

getCellByColumnAndRow()

getCellByColumnAndRow(string  $pColumn, string  $pRow = 1) : \PHPExcel_Cell

Get cell at a specific coordinate by using numeric cell coordinates

Parameters

string $pColumn

Numeric column coordinate of the cell

string $pRow

Numeric row coordinate of the cell

Returns

\PHPExcel_Cell —

Cell that was found

cellExists()

cellExists(string  $pCoordinate = 'A1') : bool

Does the cell at a specific coordinate exist?

Parameters

string $pCoordinate

Coordinate of the cell

Throws

\PHPExcel_Exception

Returns

bool —

cellExistsByColumnAndRow()

cellExistsByColumnAndRow(string  $pColumn, string  $pRow = 1) : bool

Cell at a specific coordinate by using numeric cell coordinates exists?

Parameters

string $pColumn

Numeric column coordinate of the cell

string $pRow

Numeric row coordinate of the cell

Returns

bool —

getRowDimension()

getRowDimension(int  $pRow = 1, mixed  $create = TRUE) : \PHPExcel_Worksheet_RowDimension

Get row dimension at a specific row

Parameters

int $pRow

Numeric index of the row

mixed $create

Returns

\PHPExcel_Worksheet_RowDimension —

getColumnDimension()

getColumnDimension(string  $pColumn = 'A', mixed  $create = TRUE) : \PHPExcel_Worksheet_ColumnDimension

Get column dimension at a specific column

Parameters

string $pColumn

String index of the column

mixed $create

Returns

\PHPExcel_Worksheet_ColumnDimension —

getColumnDimensionByColumn()

getColumnDimensionByColumn(string  $pColumn) : \PHPExcel_Worksheet_ColumnDimension

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

Parameters

string $pColumn

Numeric column coordinate of the cell

Returns

\PHPExcel_Worksheet_ColumnDimension —

getStyles()

getStyles() : \PHPExcel_Style[]

Get styles

Returns

\PHPExcel_Style[] —

getDefaultStyle()

getDefaultStyle() : \PHPExcel_Style

Get default style of workbook.

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Style —

setDefaultStyle()

setDefaultStyle(\PHPExcel_Style  $pValue) : \PHPExcel_Worksheet

Set default style - should only be used by PHPExcel_IReader implementations!

Parameters

\PHPExcel_Style $pValue

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

getStyle()

getStyle(string  $pCellCoordinate = 'A1') : \PHPExcel_Style

Get style for cell

Parameters

string $pCellCoordinate

Cell coordinate to get style for

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Style —

getConditionalStyles()

getConditionalStyles(string  $pCoordinate = 'A1') : \PHPExcel_Style_Conditional[]

Get conditional styles for a cell

Parameters

string $pCoordinate

Returns

\PHPExcel_Style_Conditional[] —

conditionalStylesExists()

conditionalStylesExists(string  $pCoordinate = 'A1') : bool

Do conditional styles exist for this cell?

Parameters

string $pCoordinate

Returns

bool —

removeConditionalStyles()

removeConditionalStyles(string  $pCoordinate = 'A1') : \PHPExcel_Worksheet

Removes conditional styles for a cell

Parameters

string $pCoordinate

Returns

\PHPExcel_Worksheet —

getConditionalStylesCollection()

getConditionalStylesCollection() : array

Get collection of conditional styles

Returns

array —

setConditionalStyles()

setConditionalStyles( $pCoordinate = 'A1',  $pValue) : \PHPExcel_Worksheet

Set conditional styles

Parameters

$pCoordinate

string E.g. 'A1'

$pValue

PHPExcel_Style_Conditional[]

Returns

\PHPExcel_Worksheet —

getStyleByColumnAndRow()

getStyleByColumnAndRow(int  $pColumn, int  $pRow = 1) : \PHPExcel_Style

Get style for cell by using numeric cell coordinates

Parameters

int $pColumn

Numeric column coordinate of the cell

int $pRow

Numeric row coordinate of the cell

Returns

\PHPExcel_Style —

setSharedStyle()

setSharedStyle(\PHPExcel_Style  $pSharedCellStyle = null, string  $pRange = '') : \PHPExcel_Worksheet

Set shared cell style to a range of cells

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

Parameters

\PHPExcel_Style $pSharedCellStyle

Cell style to share

string $pRange

Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

duplicateStyle()

duplicateStyle(\PHPExcel_Style  $pCellStyle = null, string  $pRange = '') : \PHPExcel_Worksheet

Duplicate cell style to a range of cells

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

Parameters

\PHPExcel_Style $pCellStyle

Cell style to duplicate

string $pRange

Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

duplicateConditionalStyle()

duplicateConditionalStyle(array  $pCellStyle = null, string  $pRange = '') : \PHPExcel_Worksheet

Duplicate conditional style to a range of cells

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

Parameters

array $pCellStyle
string $pRange

Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

duplicateStyleArray()

duplicateStyleArray(array  $pStyles = null, string  $pRange = '', bool  $pAdvanced = true) : \PHPExcel_Worksheet

Duplicate cell style array to a range of cells

Please note that this will overwrite existing cell styles for cells in range, if they are in the styles array. For example, if you decide to set a range of cells to font bold, only include font bold in the styles array.

Parameters

array $pStyles

Array containing style information

string $pRange

Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")

bool $pAdvanced

Advanced mode for setting borders.

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

setBreak()

setBreak(string  $pCell = 'A1', int  $pBreak = PHPExcel_Worksheet::BREAK_NONE) : \PHPExcel_Worksheet

Set break on a cell

Parameters

string $pCell

Cell coordinate (e.g. A1)

int $pBreak

Break type (type of PHPExcel_Worksheet::BREAK_*)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

setBreakByColumnAndRow()

setBreakByColumnAndRow(int  $pColumn, int  $pRow = 1, int  $pBreak = PHPExcel_Worksheet::BREAK_NONE) : \PHPExcel_Worksheet

Set break on a cell by using numeric cell coordinates

Parameters

int $pColumn

Numeric column coordinate of the cell

int $pRow

Numeric row coordinate of the cell

int $pBreak

Break type (type of PHPExcel_Worksheet::BREAK_*)

Returns

\PHPExcel_Worksheet —

getBreaks()

getBreaks() : array[]

Get breaks

Returns

array[] —

mergeCells()

mergeCells(string  $pRange = 'A1:A1') : \PHPExcel_Worksheet

Set merge on a cell range

Parameters

string $pRange

Cell range (e.g. A1:E1)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

mergeCellsByColumnAndRow()

mergeCellsByColumnAndRow(int  $pColumn1, int  $pRow1 = 1, int  $pColumn2, int  $pRow2 = 1) : \PHPExcel_Worksheet

Set merge on a cell range by using numeric cell coordinates

Parameters

int $pColumn1

Numeric column coordinate of the first cell

int $pRow1

Numeric row coordinate of the first cell

int $pColumn2

Numeric column coordinate of the last cell

int $pRow2

Numeric row coordinate of the last cell

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

unmergeCells()

unmergeCells(string  $pRange = 'A1:A1') : \PHPExcel_Worksheet

Remove merge on a cell range

Parameters

string $pRange

Cell range (e.g. A1:E1)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

unmergeCellsByColumnAndRow()

unmergeCellsByColumnAndRow(int  $pColumn1, int  $pRow1 = 1, int  $pColumn2, int  $pRow2 = 1) : \PHPExcel_Worksheet

Remove merge on a cell range by using numeric cell coordinates

Parameters

int $pColumn1

Numeric column coordinate of the first cell

int $pRow1

Numeric row coordinate of the first cell

int $pColumn2

Numeric column coordinate of the last cell

int $pRow2

Numeric row coordinate of the last cell

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

getMergeCells()

getMergeCells() : array[]

Get merge cells array.

Returns

array[] —

setMergeCells()

setMergeCells(mixed  $pValue = array()) : mixed

Set merge cells array for the entire sheet. Use instead mergeCells() to merge a single cell range.

Parameters

mixed $pValue

Returns

mixed —

protectCells()

protectCells(string  $pRange = 'A1', string  $pPassword = '', bool  $pAlreadyHashed = false) : \PHPExcel_Worksheet

Set protection on a cell range

Parameters

string $pRange

Cell (e.g. A1) or cell range (e.g. A1:E1)

string $pPassword

Password to unlock the protection

bool $pAlreadyHashed

If the password has already been hashed, set this to true

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

protectCellsByColumnAndRow()

protectCellsByColumnAndRow(int  $pColumn1, int  $pRow1 = 1, int  $pColumn2, int  $pRow2 = 1, string  $pPassword = '', bool  $pAlreadyHashed = false) : \PHPExcel_Worksheet

Set protection on a cell range by using numeric cell coordinates

Parameters

int $pColumn1

Numeric column coordinate of the first cell

int $pRow1

Numeric row coordinate of the first cell

int $pColumn2

Numeric column coordinate of the last cell

int $pRow2

Numeric row coordinate of the last cell

string $pPassword

Password to unlock the protection

bool $pAlreadyHashed

If the password has already been hashed, set this to true

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

unprotectCells()

unprotectCells(string  $pRange = 'A1') : \PHPExcel_Worksheet

Remove protection on a cell range

Parameters

string $pRange

Cell (e.g. A1) or cell range (e.g. A1:E1)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

unprotectCellsByColumnAndRow()

unprotectCellsByColumnAndRow(int  $pColumn1, int  $pRow1 = 1, int  $pColumn2, int  $pRow2 = 1, string  $pPassword = '', bool  $pAlreadyHashed = false) : \PHPExcel_Worksheet

Remove protection on a cell range by using numeric cell coordinates

Parameters

int $pColumn1

Numeric column coordinate of the first cell

int $pRow1

Numeric row coordinate of the first cell

int $pColumn2

Numeric column coordinate of the last cell

int $pRow2

Numeric row coordinate of the last cell

string $pPassword

Password to unlock the protection

bool $pAlreadyHashed

If the password has already been hashed, set this to true

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

getProtectedCells()

getProtectedCells() : array[]

Get protected cells

Returns

array[] —

getAutoFilter()

getAutoFilter() : mixed

Get Autofilter

@return PHPExcel_Worksheet_AutoFilter

Returns

mixed —

setAutoFilter()

setAutoFilter(mixed  $pValue) : mixed

Set AutoFilter

@param PHPExcel_Worksheet_AutoFilter|string $pValue A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility

Parameters

mixed $pValue

Throws

\PHPExcel_Exception

@return PHPExcel_Worksheet

Returns

mixed —

setAutoFilterByColumnAndRow()

setAutoFilterByColumnAndRow(mixed  $pColumn1, int  $pRow1 = 1, mixed  $pColumn2, mixed  $pRow2 = 1) : mixed

Set Autofilter Range by using numeric cell coordinates

@param integer $pColumn1 Numeric column coordinate of the first cell

Parameters

mixed $pColumn1
int $pRow1

Numeric row coordinate of the first cell @param integer $pColumn2 Numeric column coordinate of the second cell @param integer $pRow2 Numeric row coordinate of the second cell @throws PHPExcel_Exception @return PHPExcel_Worksheet

mixed $pColumn2
mixed $pRow2

Returns

mixed —

removeAutoFilter()

removeAutoFilter() : \PHPExcel_Worksheet

Remove autofilter

Returns

\PHPExcel_Worksheet —

getFreezePane()

getFreezePane() : string

Get Freeze Pane

Returns

string —

freezePane()

freezePane(string  $pCell = '') : \PHPExcel_Worksheet

Freeze Pane

Parameters

string $pCell

Cell (i.e. A2) 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 A2 (i.e row 1 and column A)

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

freezePaneByColumnAndRow()

freezePaneByColumnAndRow(int  $pColumn, int  $pRow = 1) : \PHPExcel_Worksheet

Freeze Pane by using numeric cell coordinates

Parameters

int $pColumn

Numeric column coordinate of the cell

int $pRow

Numeric row coordinate of the cell

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

unfreezePane()

unfreezePane() : \PHPExcel_Worksheet

Unfreeze Pane

Returns

\PHPExcel_Worksheet —

insertNewRowBefore()

insertNewRowBefore(int  $pBefore = 1, int  $pNumRows = 1) : \PHPExcel_Worksheet

Insert a new row, updating all possible related data

Parameters

int $pBefore

Insert before this one

int $pNumRows

Number of rows to insert

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

insertNewColumnBefore()

insertNewColumnBefore(int  $pBefore = 'A', int  $pNumCols = 1) : \PHPExcel_Worksheet

Insert a new column, updating all possible related data

Parameters

int $pBefore

Insert before this one

int $pNumCols

Number of columns to insert

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

insertNewColumnBeforeByIndex()

insertNewColumnBeforeByIndex(int  $pBefore, int  $pNumCols = 1) : \PHPExcel_Worksheet

Insert a new column, updating all possible related data

Parameters

int $pBefore

Insert before this one (numeric column coordinate of the cell)

int $pNumCols

Number of columns to insert

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

removeRow()

removeRow(int  $pRow = 1, int  $pNumRows = 1) : \PHPExcel_Worksheet

Delete a row, updating all possible related data

Parameters

int $pRow

Remove starting with this one

int $pNumRows

Number of rows to remove

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

removeColumn()

removeColumn(int  $pColumn = 'A', int  $pNumCols = 1) : \PHPExcel_Worksheet

Remove a column, updating all possible related data

Parameters

int $pColumn

Remove starting with this one

int $pNumCols

Number of columns to remove

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

removeColumnByIndex()

removeColumnByIndex(int  $pColumn, int  $pNumCols = 1) : \PHPExcel_Worksheet

Remove a column, updating all possible related data

Parameters

int $pColumn

Remove starting with this one (numeric column coordinate of the cell)

int $pNumCols

Number of columns to remove

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

getShowGridlines()

getShowGridlines() : bool

Show gridlines?

Returns

bool —

setShowGridlines()

setShowGridlines(bool  $pValue = false) : \PHPExcel_Worksheet

Set show gridlines

Parameters

bool $pValue

Show gridlines (true/false)

Returns

\PHPExcel_Worksheet —

getPrintGridlines()

getPrintGridlines() : bool

Print gridlines?

Returns

bool —

setPrintGridlines()

setPrintGridlines(bool  $pValue = false) : \PHPExcel_Worksheet

Set print gridlines

Parameters

bool $pValue

Print gridlines (true/false)

Returns

\PHPExcel_Worksheet —

getShowRowColHeaders()

getShowRowColHeaders() : bool

Show row and column headers?

Returns

bool —

setShowRowColHeaders()

setShowRowColHeaders(bool  $pValue = false) : \PHPExcel_Worksheet

Set show row and column headers

Parameters

bool $pValue

Show row and column headers (true/false)

Returns

\PHPExcel_Worksheet —

getShowSummaryBelow()

getShowSummaryBelow() : bool

Show summary below? (Row/Column outlining)

Returns

bool —

setShowSummaryBelow()

setShowSummaryBelow(bool  $pValue = true) : \PHPExcel_Worksheet

Set show summary below

Parameters

bool $pValue

Show summary below (true/false)

Returns

\PHPExcel_Worksheet —

getShowSummaryRight()

getShowSummaryRight() : bool

Show summary right? (Row/Column outlining)

Returns

bool —

setShowSummaryRight()

setShowSummaryRight(bool  $pValue = true) : \PHPExcel_Worksheet

Set show summary right

Parameters

bool $pValue

Show summary right (true/false)

Returns

\PHPExcel_Worksheet —

getComments()

getComments() : \PHPExcel_Comment[]

Get comments

Returns

\PHPExcel_Comment[] —

setComments()

setComments(mixed  $pValue = array()) : \PHPExcel_Worksheet

Set comments array for the entire sheet.

Parameters

mixed $pValue

Returns

\PHPExcel_Worksheet —

getComment()

getComment(string  $pCellCoordinate = 'A1') : \PHPExcel_Comment

Get comment for cell

Parameters

string $pCellCoordinate

Cell coordinate to get comment for

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Comment —

getCommentByColumnAndRow()

getCommentByColumnAndRow(int  $pColumn, int  $pRow = 1) : \PHPExcel_Comment

Get comment for cell by using numeric cell coordinates

Parameters

int $pColumn

Numeric column coordinate of the cell

int $pRow

Numeric row coordinate of the cell

Returns

\PHPExcel_Comment —

getSelectedCell()

getSelectedCell() : string

Get selected cell

Returns

string —

getActiveCell()

getActiveCell() : string

Get active cell

Returns

string —

Example: 'A1'

getSelectedCells()

getSelectedCells() : string

Get selected cells

Returns

string —

setSelectedCell()

setSelectedCell(string  $pCoordinate = 'A1') : \PHPExcel_Worksheet

Selected cell

Parameters

string $pCoordinate

Cell (i.e. A1)

Returns

\PHPExcel_Worksheet —

setSelectedCells()

setSelectedCells(string  $pCoordinate = 'A1') : \PHPExcel_Worksheet

Select a range of cells.

Parameters

string $pCoordinate

Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6'

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

setSelectedCellByColumnAndRow()

setSelectedCellByColumnAndRow(int  $pColumn, int  $pRow = 1) : \PHPExcel_Worksheet

Selected cell by using numeric cell coordinates

Parameters

int $pColumn

Numeric column coordinate of the cell

int $pRow

Numeric row coordinate of the cell

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

getRightToLeft()

getRightToLeft() : bool

Get right-to-left

Returns

bool —

setRightToLeft()

setRightToLeft(bool  $value = false) : \PHPExcel_Worksheet

Set right-to-left

Parameters

bool $value

Right-to-left true/false

Returns

\PHPExcel_Worksheet —

fromArray()

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

Fill worksheet from values in array

Parameters

array $source

Source array

mixed $nullValue

Value in source array that stands for blank cell

string $startCell

Insert array starting from this cell address as the top left coordinate

bool $strictNullComparison

Apply strict comparison when testing for null values in the array

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

rangeToArray()

rangeToArray(string  $pRange = 'A1', mixed  $nullValue = null, bool  $calculateFormulas = true, bool  $formatData = true, bool  $returnCellRef = false) : array

Create array from a range of cells

Parameters

string $pRange

Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")

mixed $nullValue

Value returned in the array entry if a cell doesn't exist

bool $calculateFormulas

Should formulas be calculated?

bool $formatData

Should formatting be applied to cell values?

bool $returnCellRef

False - 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

Returns

array —

namedRangeToArray()

namedRangeToArray(string  $pNamedRange = '', mixed  $nullValue = null, bool  $calculateFormulas = true, bool  $formatData = true, bool  $returnCellRef = false) : array

Create array from a range of cells

Parameters

string $pNamedRange

Name of the Named Range

mixed $nullValue

Value returned in the array entry if a cell doesn't exist

bool $calculateFormulas

Should formulas be calculated?

bool $formatData

Should formatting be applied to cell values?

bool $returnCellRef

False - 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

Throws

\PHPExcel_Exception

Returns

array —

toArray()

toArray(mixed  $nullValue = null, bool  $calculateFormulas = true, bool  $formatData = true, bool  $returnCellRef = false) : array

Create array from worksheet

Parameters

mixed $nullValue

Value returned in the array entry if a cell doesn't exist

bool $calculateFormulas

Should formulas be calculated?

bool $formatData

Should formatting be applied to cell values?

bool $returnCellRef

False - 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

Returns

array —

getRowIterator()

getRowIterator(int  $startRow = 1) : \PHPExcel_Worksheet_RowIterator

Get row iterator

Parameters

int $startRow

The row number at which to start iterating

Returns

\PHPExcel_Worksheet_RowIterator —

garbageCollect()

garbageCollect() : \PHPExcel_Worksheet

Run PHPExcel garabage collector.

Returns

\PHPExcel_Worksheet —

getHashCode()

getHashCode() : string

Get hash code

Returns

string —

Hash code

extractSheetTitle()

extractSheetTitle(string  $pRange, bool  $returnRange = false) : mixed

Extract worksheet title from range.

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

Parameters

string $pRange

Range to extract title from

bool $returnRange

Return range? (see example)

Returns

mixed —

getHyperlink()

getHyperlink(string  $pCellCoordinate = 'A1') : mixed

Get hyperlink

Parameters

string $pCellCoordinate

Cell coordinate to get hyperlink for

Returns

mixed —

setHyperlink()

setHyperlink(string  $pCellCoordinate = 'A1', \PHPExcel_Cell_Hyperlink  $pHyperlink = null) : \PHPExcel_Worksheet

Set hyperlnk

Parameters

string $pCellCoordinate

Cell coordinate to insert hyperlink

\PHPExcel_Cell_Hyperlink $pHyperlink

Returns

\PHPExcel_Worksheet —

hyperlinkExists()

hyperlinkExists(string  $pCoordinate = 'A1') : bool

Hyperlink at a specific coordinate exists?

Parameters

string $pCoordinate

Returns

bool —

getHyperlinkCollection()

getHyperlinkCollection() : \PHPExcel_Cell_Hyperlink[]

Get collection of hyperlinks

Returns

\PHPExcel_Cell_Hyperlink[] —

getDataValidation()

getDataValidation(string  $pCellCoordinate = 'A1') : mixed

Get data validation

Parameters

string $pCellCoordinate

Cell coordinate to get data validation for

Returns

mixed —

setDataValidation()

setDataValidation(string  $pCellCoordinate = 'A1', \PHPExcel_Cell_DataValidation  $pDataValidation = null) : \PHPExcel_Worksheet

Set data validation

Parameters

string $pCellCoordinate

Cell coordinate to insert data validation

\PHPExcel_Cell_DataValidation $pDataValidation

Returns

\PHPExcel_Worksheet —

dataValidationExists()

dataValidationExists(string  $pCoordinate = 'A1') : bool

Data validation at a specific coordinate exists?

Parameters

string $pCoordinate

Returns

bool —

getDataValidationCollection()

getDataValidationCollection() : \PHPExcel_Cell_DataValidation[]

Get collection of data validations

Returns

\PHPExcel_Cell_DataValidation[] —

shrinkRangeToFit()

shrinkRangeToFit(string  $range) : string

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

Parameters

string $range

Returns

string —

Adjusted range value

getTabColor()

getTabColor() : \PHPExcel_Style_Color

Get tab color

Returns

\PHPExcel_Style_Color —

resetTabColor()

resetTabColor() : \PHPExcel_Worksheet

Reset tab color

Returns

\PHPExcel_Worksheet —

isTabColorSet()

isTabColorSet() : bool

Tab color set?

Returns

bool —

copy()

copy() : \PHPExcel_Worksheet

Copy worksheet (!= clone!)

Returns

\PHPExcel_Worksheet —

__clone()

__clone() : mixed

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

Returns

mixed —

setCodeName()

setCodeName(mixed  $pValue = null) : \objWorksheet

Define the code name of the sheet

Parameters

mixed $pValue

Throws

\PHPExcel_Exception

Returns

\objWorksheet —

getCodeName()

getCodeName() : null|string

Return the code name of the sheet

Returns

null|string —

hasCodeName()

hasCodeName() : bool

Sheet has a code name ?

Returns

bool —

_checkSheetCodeName()

_checkSheetCodeName(string  $pValue) : string

Check sheet code name for valid Excel syntax

Parameters

string $pValue

The string to check

Throws

\Exception

Returns

string —

The valid string

_checkSheetTitle()

_checkSheetTitle(string  $pValue) : string

Check sheet title for valid Excel syntax

Parameters

string $pValue

The string to check

Throws

\PHPExcel_Exception

Returns

string —

The valid string

_createNewCell()

_createNewCell(string  $pCoordinate) : \PHPExcel_Cell

Create a new cell at the specified coordinate

Parameters

string $pCoordinate

Coordinate of the cell

Returns

\PHPExcel_Cell —

Cell that was created