\PHPExcel

PHPExcel

Copyright (c) 2006 - 2015 PHPExcel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Summary

Methods
Properties
Constants
hasMacros()
setHasMacros()
setMacrosCode()
getMacrosCode()
setMacrosCertificate()
hasMacrosCertificate()
getMacrosCertificate()
discardMacros()
setRibbonXMLData()
getRibbonXMLData()
setRibbonBinObjects()
getRibbonBinObjects()
hasRibbon()
hasRibbonBinObjects()
sheetCodeNameExists()
getSheetByCodeName()
__construct()
__destruct()
disconnectWorksheets()
getCalculationEngine()
getProperties()
setProperties()
getSecurity()
setSecurity()
getActiveSheet()
createSheet()
sheetNameExists()
addSheet()
removeSheetByIndex()
getSheet()
getAllSheets()
getSheetByName()
getIndex()
setIndexByName()
getSheetCount()
getActiveSheetIndex()
setActiveSheetIndex()
setActiveSheetIndexByName()
getSheetNames()
addExternalSheet()
getNamedRanges()
addNamedRange()
getNamedRange()
removeNamedRange()
getWorksheetIterator()
copy()
__clone()
getCellXfCollection()
getCellXfByIndex()
getCellXfByHashCode()
cellXfExists()
getDefaultStyle()
addCellXf()
removeCellXfByIndex()
getCellXfSupervisor()
getCellStyleXfCollection()
getCellStyleXfByIndex()
getCellStyleXfByHashCode()
addCellStyleXf()
removeCellStyleXfByIndex()
garbageCollect()
getID()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
getExtensionOnly()
$uniqueID
$properties
$security
$workSheetCollection
$calculationEngine
$activeSheetIndex
$namedRanges
$cellXfSupervisor
$cellXfCollection
$cellStyleXfCollection
$hasMacros
$macrosCode
$macrosCertificate
$ribbonXMLData
$ribbonBinObjects
N/A

Properties

$uniqueID

$uniqueID : string

Unique ID

Type

string

$workSheetCollection

$workSheetCollection : array<mixed,\PHPExcel_Worksheet>

Collection of Worksheet objects

Type

array<mixed,\PHPExcel_Worksheet>

$calculationEngine

$calculationEngine : \PHPExcel_Calculation

Calculation Engine

Type

\PHPExcel_Calculation

$activeSheetIndex

$activeSheetIndex : integer

Active sheet index

Type

integer

$namedRanges

$namedRanges : array<mixed,\PHPExcel_NamedRange>

Named ranges

Type

array<mixed,\PHPExcel_NamedRange>

$cellXfSupervisor

$cellXfSupervisor : \PHPExcel_Style

CellXf supervisor

Type

\PHPExcel_Style

$cellXfCollection

$cellXfCollection : array<mixed,\PHPExcel_Style>

CellXf collection

Type

array<mixed,\PHPExcel_Style>

$cellStyleXfCollection

$cellStyleXfCollection : array<mixed,\PHPExcel_Style>

CellStyleXf collection

Type

array<mixed,\PHPExcel_Style>

$hasMacros

$hasMacros : boolean

hasMacros : this workbook have macros ?

Type

boolean

$macrosCode

$macrosCode : \binary

macrosCode : all macros code (the vbaProject.bin file, this include form, code, etc.), null if no macro

Type

\binary

$macrosCertificate

$macrosCertificate : \binary

macrosCertificate : if macros are signed, contains vbaProjectSignature.bin file, null if not signed

Type

\binary

$ribbonXMLData

$ribbonXMLData : null|string

ribbonXMLData : null if workbook is'nt Excel 2007 or not contain a customized UI

Type

null|string

$ribbonBinObjects

$ribbonBinObjects : null|array

ribbonBinObjects : null if workbook is'nt Excel 2007 or not contain embedded objects (picture(s)) for Ribbon Elements ignored if $ribbonXMLData is null

Type

null|array

Methods

hasMacros()

hasMacros() : boolean

The workbook has macros ?

Returns

boolean —

true if workbook has macros, false if not

setHasMacros()

setHasMacros(boolean  $hasMacros = false) 

Define if a workbook has macros

Parameters

boolean $hasMacros

true|false

setMacrosCode()

setMacrosCode(string  $MacrosCode = null) 

Set the macros code

Parameters

string $MacrosCode

string|null

getMacrosCode()

getMacrosCode() : string|null

Return the macros code

Returns

string|null

setMacrosCertificate()

setMacrosCertificate(string|null  $Certificate = null) 

Set the macros certificate

Parameters

string|null $Certificate

hasMacrosCertificate()

hasMacrosCertificate() : boolean

Is the project signed ?

Returns

boolean —

true|false

getMacrosCertificate()

getMacrosCertificate() : string|null

Return the macros certificate

Returns

string|null

discardMacros()

discardMacros() 

Remove all macros, certificate from spreadsheet

setRibbonXMLData()

setRibbonXMLData(  $Target = null,   $XMLData = null) 

set ribbon XML data

Parameters

$Target
$XMLData

getRibbonXMLData()

getRibbonXMLData(  $What = 'all') 

retrieve ribbon XML Data

return string|null|array

Parameters

$What

setRibbonBinObjects()

setRibbonBinObjects(  $BinObjectsNames = null,   $BinObjectsData = null) 

store binaries ribbon objects (pictures)

Parameters

$BinObjectsNames
$BinObjectsData

getRibbonBinObjects()

getRibbonBinObjects(  $What = 'all') 

retrieve Binaries Ribbon Objects

Parameters

$What

hasRibbon()

hasRibbon() : boolean

This workbook have a custom UI ?

Returns

boolean —

true|false

hasRibbonBinObjects()

hasRibbonBinObjects() : boolean

This workbook have additionnal object for the ribbon ?

Returns

boolean —

true|false

sheetCodeNameExists()

sheetCodeNameExists(string  $pSheetCodeName) : boolean

Check if a sheet with a specified code name already exists

Parameters

string $pSheetCodeName

Name of the worksheet to check

Returns

boolean

getSheetByCodeName()

getSheetByCodeName(string  $pName = '') : \PHPExcel_Worksheet

Get sheet by code name. Warning : sheet don't have always a code name !

Parameters

string $pName

Sheet name

Returns

\PHPExcel_Worksheet

__construct()

__construct() 

Create a new PHPExcel with one Worksheet

__destruct()

__destruct() 

Code to execute when this worksheet is unset()

disconnectWorksheets()

disconnectWorksheets() 

Disconnect all worksheets from this PHPExcel workbook object, typically so that the PHPExcel object can be unset

getCalculationEngine()

getCalculationEngine() : \PHPExcel_Calculation

Return the calculation engine for this worksheet

Returns

\PHPExcel_Calculation

getActiveSheet()

getActiveSheet() : \PHPExcel_Worksheet

Get active sheet

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

createSheet()

createSheet(integer|null  $iSheetIndex = null) : \PHPExcel_Worksheet

Create sheet and add it to this workbook

Parameters

integer|null $iSheetIndex

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

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

sheetNameExists()

sheetNameExists(string  $pSheetName) : boolean

Check if a sheet with a specified name already exists

Parameters

string $pSheetName

Name of the worksheet to check

Returns

boolean

addSheet()

addSheet(\PHPExcel_Worksheet  $pSheet, integer|null  $iSheetIndex = null) : \PHPExcel_Worksheet

Add sheet

Parameters

\PHPExcel_Worksheet $pSheet
integer|null $iSheetIndex

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

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

removeSheetByIndex()

removeSheetByIndex(integer  $pIndex) 

Remove sheet by index

Parameters

integer $pIndex

Active sheet index

Throws

\PHPExcel_Exception

getSheet()

getSheet(integer  $pIndex) : \PHPExcel_Worksheet

Get sheet by index

Parameters

integer $pIndex

Sheet index

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

getAllSheets()

getAllSheets() : array<mixed,\PHPExcel_Worksheet>

Get all sheets

Returns

array<mixed,\PHPExcel_Worksheet>

getSheetByName()

getSheetByName(string  $pName = '') : \PHPExcel_Worksheet

Get sheet by name

Parameters

string $pName

Sheet name

Returns

\PHPExcel_Worksheet

getIndex()

getIndex(\PHPExcel_Worksheet  $pSheet) : integer

Get index for sheet

Parameters

\PHPExcel_Worksheet $pSheet

Throws

\PHPExcel_Exception

Returns

integer —

Sheet index

setIndexByName()

setIndexByName(string  $sheetName, integer  $newIndex) : integer

Set index for sheet by sheet name.

Parameters

string $sheetName

Sheet name to modify index for

integer $newIndex

New index for the sheet

Throws

\PHPExcel_Exception

Returns

integer —

New sheet index

getSheetCount()

getSheetCount() : integer

Get sheet count

Returns

integer

getActiveSheetIndex()

getActiveSheetIndex() : integer

Get active sheet index

Returns

integer —

Active sheet index

setActiveSheetIndex()

setActiveSheetIndex(integer  $pIndex) : \PHPExcel_Worksheet

Set active sheet index

Parameters

integer $pIndex

Active sheet index

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

setActiveSheetIndexByName()

setActiveSheetIndexByName(string  $pValue = '') : \PHPExcel_Worksheet

Set active sheet index by name

Parameters

string $pValue

Sheet title

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

getSheetNames()

getSheetNames() : array<mixed,string>

Get sheet names

Returns

array<mixed,string>

addExternalSheet()

addExternalSheet(\PHPExcel_Worksheet  $pSheet, integer|null  $iSheetIndex = null) : \PHPExcel_Worksheet

Add external sheet

Parameters

\PHPExcel_Worksheet $pSheet

External sheet to add

integer|null $iSheetIndex

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

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet

getNamedRanges()

getNamedRanges() : array<mixed,\PHPExcel_NamedRange>

Get named ranges

Returns

array<mixed,\PHPExcel_NamedRange>

addNamedRange()

addNamedRange(\PHPExcel_NamedRange  $namedRange) : boolean

Add named range

Parameters

\PHPExcel_NamedRange $namedRange

Returns

boolean

getNamedRange()

getNamedRange(string  $namedRange, \PHPExcel_Worksheet|null  $pSheet = null) : \PHPExcel_NamedRange|null

Get named range

Parameters

string $namedRange
\PHPExcel_Worksheet|null $pSheet

Scope. Use null for global scope

Returns

\PHPExcel_NamedRange|null

removeNamedRange()

removeNamedRange(string  $namedRange, \PHPExcel_Worksheet|null  $pSheet = null) : \PHPExcel

Remove named range

Parameters

string $namedRange
\PHPExcel_Worksheet|null $pSheet

Scope: use null for global scope.

Returns

\PHPExcel

getWorksheetIterator()

getWorksheetIterator() : \PHPExcel_WorksheetIterator

Get worksheet iterator

Returns

\PHPExcel_WorksheetIterator

copy()

copy() : \PHPExcel

Copy workbook (!= clone!)

Returns

\PHPExcel

__clone()

__clone() 

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

getCellXfCollection()

getCellXfCollection() : array<mixed,\PHPExcel_Style>

Get the workbook collection of cellXfs

Returns

array<mixed,\PHPExcel_Style>

getCellXfByIndex()

getCellXfByIndex(integer  $pIndex) : \PHPExcel_Style

Get cellXf by index

Parameters

integer $pIndex

Returns

\PHPExcel_Style

getCellXfByHashCode()

getCellXfByHashCode(string  $pValue = '') : \PHPExcel_Style|boolean

Get cellXf by hash code

Parameters

string $pValue

Returns

\PHPExcel_Style|boolean —

False if no match found

cellXfExists()

cellXfExists(\PHPExcel_Style  $pCellStyle = null) : boolean

Check if style exists in style collection

Parameters

\PHPExcel_Style $pCellStyle

Returns

boolean

getDefaultStyle()

getDefaultStyle() : \PHPExcel_Style

Get default style

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Style

addCellXf()

addCellXf(\PHPExcel_Style  $style) 

Add a cellXf to the workbook

Parameters

\PHPExcel_Style $style

removeCellXfByIndex()

removeCellXfByIndex(integer  $pIndex) 

Remove cellXf by index. It is ensured that all cells get their xf index updated.

Parameters

integer $pIndex

Index to cellXf

Throws

\PHPExcel_Exception

getCellXfSupervisor()

getCellXfSupervisor() : \PHPExcel_Style

Get the cellXf supervisor

Returns

\PHPExcel_Style

getCellStyleXfCollection()

getCellStyleXfCollection() : array<mixed,\PHPExcel_Style>

Get the workbook collection of cellStyleXfs

Returns

array<mixed,\PHPExcel_Style>

getCellStyleXfByIndex()

getCellStyleXfByIndex(integer  $pIndex) : \PHPExcel_Style

Get cellStyleXf by index

Parameters

integer $pIndex

Index to cellXf

Returns

\PHPExcel_Style

getCellStyleXfByHashCode()

getCellStyleXfByHashCode(string  $pValue = '') : \PHPExcel_Style|boolean

Get cellStyleXf by hash code

Parameters

string $pValue

Returns

\PHPExcel_Style|boolean —

False if no match found

addCellStyleXf()

addCellStyleXf(\PHPExcel_Style  $pStyle) 

Add a cellStyleXf to the workbook

Parameters

\PHPExcel_Style $pStyle

removeCellStyleXfByIndex()

removeCellStyleXfByIndex(integer  $pIndex) 

Remove cellStyleXf by index

Parameters

integer $pIndex

Index to cellXf

Throws

\PHPExcel_Exception

garbageCollect()

garbageCollect() 

Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells and columns in the workbook

getID()

getID() : string

Return the unique ID value assigned to this spreadsheet workbook

Returns

string

getExtensionOnly()

getExtensionOnly(  $ThePath) 

return the extension of a filename. Internal use for a array_map callback (php<5.3 don't like lambda function)

Parameters

$ThePath