\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 : \PHPExcel_Worksheet[]

Collection of Worksheet objects

Type

PHPExcel_Worksheet[] —

$calculationEngine

$calculationEngine : \PHPExcel_Calculation

Calculation Engine

Type

PHPExcel_Calculation —

$activeSheetIndex

$activeSheetIndex : int

Active sheet index

Type

int —

$cellXfSupervisor

$cellXfSupervisor : \PHPExcel_Style

CellXf supervisor

Type

PHPExcel_Style —

$cellXfCollection

$cellXfCollection : \PHPExcel_Style[]

CellXf collection

Type

PHPExcel_Style[] —

$cellStyleXfCollection

$cellStyleXfCollection : \PHPExcel_Style[]

CellStyleXf collection

Type

PHPExcel_Style[] —

$hasMacros

$hasMacros : bool

hasMacros : this workbook have macros ?

Type

bool —

$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() : bool

The workbook has macros ?

Returns

bool —

true if workbook has macros, false if not

setHasMacros()

setHasMacros(bool  $hasMacros = false) : mixed

Define if a workbook has macros

Parameters

bool $hasMacros

true|false

Returns

mixed —

setMacrosCode()

setMacrosCode(string  $MacrosCode = null) : mixed

Set the macros code

Parameters

string $MacrosCode

string|null

Returns

mixed —

getMacrosCode()

getMacrosCode() : string|null

Return the macros code

Returns

string|null —

setMacrosCertificate()

setMacrosCertificate(string|null  $Certificate = null) : mixed

Set the macros certificate

Parameters

string|null $Certificate

Returns

mixed —

hasMacrosCertificate()

hasMacrosCertificate() : bool

Is the project signed ?

Returns

bool —

true|false

getMacrosCertificate()

getMacrosCertificate() : string|null

Return the macros certificate

Returns

string|null —

discardMacros()

discardMacros() : mixed

Remove all macros, certificate from spreadsheet

Returns

mixed —

setRibbonXMLData()

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

set ribbon XML data

Parameters

mixed $Target
mixed $XMLData

Returns

mixed —

getRibbonXMLData()

getRibbonXMLData(mixed  $What = 'all') : mixed

retrieve ribbon XML Data

return string|null|array

Parameters

mixed $What

Returns

mixed —

setRibbonBinObjects()

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

store binaries ribbon objects (pictures)

Parameters

mixed $BinObjectsNames
mixed $BinObjectsData

Returns

mixed —

getRibbonBinObjects()

getRibbonBinObjects(mixed  $What = 'all') : mixed

retrieve Binaries Ribbon Objects

Parameters

mixed $What

Returns

mixed —

hasRibbon()

hasRibbon() : bool

This workbook have a custom UI ?

Returns

bool —

true|false

hasRibbonBinObjects()

hasRibbonBinObjects() : bool

This workbook have additionnal object for the ribbon ?

Returns

bool —

true|false

sheetCodeNameExists()

sheetCodeNameExists(string  $pSheetCodeName) : bool

Check if a sheet with a specified code name already exists

Parameters

string $pSheetCodeName

Name of the worksheet to check

Returns

bool —

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

Create a new PHPExcel with one Worksheet

Returns

mixed —

__destruct()

__destruct() : mixed

Code to execute when this worksheet is unset()

Returns

mixed —

disconnectWorksheets()

disconnectWorksheets() : mixed

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

Returns

mixed —

getCalculationEngine()

getCalculationEngine() : \PHPExcel_Calculation

Return the calculation engine for this worksheet

Returns

\PHPExcel_Calculation —

getProperties()

getProperties() : \PHPExcel_DocumentProperties

Get properties

Returns

\PHPExcel_DocumentProperties —

setProperties()

setProperties(\PHPExcel_DocumentProperties  $pValue) : mixed

Set properties

Parameters

\PHPExcel_DocumentProperties $pValue

Returns

mixed —

getSecurity()

getSecurity() : \PHPExcel_DocumentSecurity

Get security

Returns

\PHPExcel_DocumentSecurity —

setSecurity()

setSecurity(\PHPExcel_DocumentSecurity  $pValue) : mixed

Set security

Parameters

\PHPExcel_DocumentSecurity $pValue

Returns

mixed —

getActiveSheet()

getActiveSheet() : \PHPExcel_Worksheet

Get active sheet

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

createSheet()

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

Create sheet and add it to this workbook

Parameters

int|null $iSheetIndex

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

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

sheetNameExists()

sheetNameExists(string  $pSheetName) : bool

Check if a sheet with a specified name already exists

Parameters

string $pSheetName

Name of the worksheet to check

Returns

bool —

addSheet()

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

Add sheet

Parameters

\PHPExcel_Worksheet $pSheet
int|null $iSheetIndex

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

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

removeSheetByIndex()

removeSheetByIndex(int  $pIndex) : mixed

Remove sheet by index

Parameters

int $pIndex

Active sheet index

Throws

\PHPExcel_Exception

Returns

mixed —

getSheet()

getSheet(int  $pIndex) : \PHPExcel_Worksheet

Get sheet by index

Parameters

int $pIndex

Sheet index

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

getAllSheets()

getAllSheets() : \PHPExcel_Worksheet[]

Get all sheets

Returns

\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) : int

Get index for sheet

Parameters

\PHPExcel_Worksheet $pSheet

Throws

\PHPExcel_Exception

Returns

int —

Sheet index

setIndexByName()

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

Set index for sheet by sheet name.

Parameters

string $sheetName

Sheet name to modify index for

int $newIndex

New index for the sheet

Throws

\PHPExcel_Exception

Returns

int —

New sheet index

getSheetCount()

getSheetCount() : int

Get sheet count

Returns

int —

getActiveSheetIndex()

getActiveSheetIndex() : int

Get active sheet index

Returns

int —

Active sheet index

setActiveSheetIndex()

setActiveSheetIndex(int  $pIndex) : \PHPExcel_Worksheet

Set active sheet index

Parameters

int $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() : string[]

Get sheet names

Returns

string[] —

addExternalSheet()

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

Add external sheet

Parameters

\PHPExcel_Worksheet $pSheet

External sheet to add

int|null $iSheetIndex

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

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Worksheet —

getNamedRanges()

getNamedRanges() : \PHPExcel_NamedRange[]

Get named ranges

Returns

\PHPExcel_NamedRange[] —

addNamedRange()

addNamedRange(\PHPExcel_NamedRange  $namedRange) : bool

Add named range

Parameters

\PHPExcel_NamedRange $namedRange

Returns

bool —

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

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

Returns

mixed —

getCellXfCollection()

getCellXfCollection() : \PHPExcel_Style[]

Get the workbook collection of cellXfs

Returns

\PHPExcel_Style[] —

getCellXfByIndex()

getCellXfByIndex(int  $pIndex) : \PHPExcel_Style

Get cellXf by index

Parameters

int $pIndex

Returns

\PHPExcel_Style —

getCellXfByHashCode()

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

Get cellXf by hash code

Parameters

string $pValue

Returns

\PHPExcel_Style|bool —

False if no match found

cellXfExists()

cellXfExists(\PHPExcel_Style  $pCellStyle = null) : bool

Check if style exists in style collection

Parameters

\PHPExcel_Style $pCellStyle

Returns

bool —

getDefaultStyle()

getDefaultStyle() : \PHPExcel_Style

Get default style

Throws

\PHPExcel_Exception

Returns

\PHPExcel_Style —

addCellXf()

addCellXf(\PHPExcel_Style  $style) : mixed

Add a cellXf to the workbook

Parameters

\PHPExcel_Style $style

Returns

mixed —

removeCellXfByIndex()

removeCellXfByIndex(int  $pIndex) : mixed

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

Parameters

int $pIndex

Index to cellXf

Throws

\PHPExcel_Exception

Returns

mixed —

getCellXfSupervisor()

getCellXfSupervisor() : \PHPExcel_Style

Get the cellXf supervisor

Returns

\PHPExcel_Style —

getCellStyleXfCollection()

getCellStyleXfCollection() : \PHPExcel_Style[]

Get the workbook collection of cellStyleXfs

Returns

\PHPExcel_Style[] —

getCellStyleXfByIndex()

getCellStyleXfByIndex(int  $pIndex) : \PHPExcel_Style

Get cellStyleXf by index

Parameters

int $pIndex

Index to cellXf

Returns

\PHPExcel_Style —

getCellStyleXfByHashCode()

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

Get cellStyleXf by hash code

Parameters

string $pValue

Returns

\PHPExcel_Style|bool —

False if no match found

addCellStyleXf()

addCellStyleXf(\PHPExcel_Style  $pStyle) : mixed

Add a cellStyleXf to the workbook

Parameters

\PHPExcel_Style $pStyle

Returns

mixed —

removeCellStyleXfByIndex()

removeCellStyleXfByIndex(int  $pIndex) : mixed

Remove cellStyleXf by index

Parameters

int $pIndex

Index to cellXf

Throws

\PHPExcel_Exception

Returns

mixed —

garbageCollect()

garbageCollect() : mixed

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

Returns

mixed —

getID()

getID() : string

Return the unique ID value assigned to this spreadsheet workbook

Returns

string —

getExtensionOnly()

getExtensionOnly(mixed  $ThePath) : mixed

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

Parameters

mixed $ThePath

Returns

mixed —