PHPExcel

category | PHPExcel
package | PHPExcel
copyright | Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)

### Methods

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

    __clone()

## Create a new PHPExcel with one Worksheet

    __construct()

## Code to execute when this worksheet is unset()

    __destruct()

## Add a cellStyleXf to the workbook

    addCellStyleXf(\PHPExcel_Style $pStyle)

### Parameters

#### $pStyle

`\PHPExcel_Style`

## Add a cellXf to the workbook

    addCellXf(\PHPExcel_Style $style)

### Parameters

#### $style

`\PHPExcel_Style`

## Add external sheet

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

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

External sheet to add

#### $iSheetIndex

`int` `null`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Add named range

    addNamedRange(\PHPExcel_NamedRange $namedRange) : \PHPExcel

### Parameters

#### $namedRange

`\PHPExcel_NamedRange`

### Returns

`\PHPExcel`

## Add sheet

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

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

#### $iSheetIndex

`int` `null`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Check if style exists in style collection

    cellXfExists(\PHPExcel_Style $pCellStyle) : boolean

### Parameters

#### $pCellStyle

`\PHPExcel_Style`

### Returns

`boolean`

## Copy workbook (!= clone!)

    copy() : \PHPExcel

### Returns

`\PHPExcel`

## Create sheet and add it to this workbook

    createSheet(int | null $iSheetIndex) : \PHPExcel_Worksheet

### Parameters

#### $iSheetIndex

`int` `null`

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

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Remove all macros, certificate from spreadsheet

    discardMacros() : void

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

    disconnectWorksheets()

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

    garbageCollect()

## Get active sheet

    getActiveSheet() : \PHPExcel_Worksheet

### Returns

`\PHPExcel_Worksheet`

## Get active sheet index

    getActiveSheetIndex() : int

### Returns

`int`Active sheet index

## Get all sheets

    getAllSheets() : \PHPExcel_Worksheet[]

### Returns

`\PHPExcel_Worksheet[]`

## Return the calculation engine for this worksheet

    getCalculationEngine() : \PHPExcel_Calculation

### Returns

`\PHPExcel_Calculation`

## Get cellStyleXf by hash code

    getCellStyleXfByHashCode(string $pValue) : \PHPExcel_Style | false

### Parameters

#### $pValue

`string`

### Returns

`\PHPExcel_Style` `false`

## Get cellStyleXf by index

    getCellStyleXfByIndex(int $pIndex) : \PHPExcel_Style

### Parameters

#### $pIndex

`int`

### Returns

`\PHPExcel_Style`

## Get the workbook collection of cellStyleXfs

    getCellStyleXfCollection() : \PHPExcel_Style[]

### Returns

`\PHPExcel_Style[]`

## Get cellXf by hash code

    getCellXfByHashCode(string $pValue) : \PHPExcel_Style | false

### Parameters

#### $pValue

`string`

### Returns

`\PHPExcel_Style` `false`

## Get cellXf by index

    getCellXfByIndex(int $pIndex) : \PHPExcel_Style

### Parameters

#### $pIndex

`int`

### Returns

`\PHPExcel_Style`

## Get the workbook collection of cellXfs

    getCellXfCollection() : \PHPExcel_Style[]

### Returns

`\PHPExcel_Style[]`

## Get the cellXf supervisor

    getCellXfSupervisor() : \PHPExcel_Style

### Returns

`\PHPExcel_Style`

## Get default style

    getDefaultStyle() : \PHPExcel_Style

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Style`

## Return the unique ID value assigned to this spreadsheet workbook

    getID() : string

### Returns

`string`

## Get index for sheet

    getIndex(\PHPExcel_Worksheet $pSheet) : \Sheet

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\Sheet`index

## Return the macros certificate

    getMacrosCertificate() : \binary | null

### Returns

`\binary` `null`

## Return the macros code

    getMacrosCode() : \binary | null

### Returns

`\binary` `null`

## Get named range

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

### Parameters

#### $namedRange

`string`

#### $pSheet

`\PHPExcel_Worksheet` `null`

Scope. Use null for global scope

### Returns

`\PHPExcel_NamedRange` `null`

## Get named ranges

    getNamedRanges() : \PHPExcel_NamedRange[]

### Returns

`\PHPExcel_NamedRange[]`

## Get properties

    getProperties() : \PHPExcel_DocumentProperties

### Returns

`\PHPExcel_DocumentProperties`

## retrieve Binaries Ribbon Objects

    getRibbonBinObjects($What)

### Parameters

#### $What

## retrieve ribbon XML Data

    getRibbonXMLData($What)

return string|null|array

### Parameters

#### $What

## Get security

    getSecurity() : \PHPExcel_DocumentSecurity

### Returns

`\PHPExcel_DocumentSecurity`

## Get sheet by index

    getSheet(int $pIndex) : \PHPExcel_Worksheet

### Parameters

#### $pIndex

`int`

Sheet index

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Get sheet by code name.

    getSheetByCodeName(string $pName) : \PHPExcel_Worksheet

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

### Parameters

#### $pName

`string`

Sheet name

### Returns

`\PHPExcel_Worksheet`

## Get sheet by name

    getSheetByName(string $pName) : \PHPExcel_Worksheet

### Parameters

#### $pName

`string`

Sheet name

### Returns

`\PHPExcel_Worksheet`

## Get sheet count

    getSheetCount() : int

### Returns

`int`

## Get sheet names

    getSheetNames() : string[]

### Returns

`string[]`

## Get worksheet iterator

    getWorksheetIterator() : \PHPExcel_WorksheetIterator

### Returns

`\PHPExcel_WorksheetIterator`

## The workbook has macros ?

    hasMacros() : true

### Returns

`true`if workbook has macros, false if not

## Is the project signed ?

    hasMacrosCertificate() : true | false

### Returns

`true` `false`

## This workbook have a custom UI ?

    hasRibbon() : true | false

### Returns

`true` `false`

## This workbook have additionnal object for the ribbon ?

    hasRibbonBinObjects() : true | false

### Returns

`true` `false`

## Remove cellStyleXf by index

    removeCellStyleXfByIndex(int $pIndex)

### Parameters

#### $pIndex

`int`

### Exceptions

`\PHPExcel_Exception` |

## Remove cellXf by index.

    removeCellXfByIndex(int $pIndex)

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

### Parameters

#### $pIndex

`int`

Index to cellXf

### Exceptions

`\PHPExcel_Exception` |

## Remove named range

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

### Parameters

#### $namedRange

`string`

#### $pSheet

`\PHPExcel_Worksheet` `null`

Scope: use null for global scope.

### Returns

`\PHPExcel`

## Remove sheet by index

    removeSheetByIndex(int $pIndex)

### Parameters

#### $pIndex

`int`

Active sheet index

### Exceptions

`\PHPExcel_Exception` |

## Set active sheet index

    setActiveSheetIndex(int $pIndex) : \PHPExcel_Worksheet

### Parameters

#### $pIndex

`int`

Active sheet index

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Set active sheet index by name

    setActiveSheetIndexByName(string $pValue) : \PHPExcel_Worksheet

### Parameters

#### $pValue

`string`

Sheet title

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\PHPExcel_Worksheet`

## Define if a workbook has macros

    setHasMacros(true | false $hasMacros)

### Parameters

#### $hasMacros

`true` `false`

## Set index for sheet by sheet name.

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

### Parameters

#### $sheetName

`string`

Sheet name to modify index for

#### $newIndex

`int`

New index for the sheet

### Exceptions

`\PHPExcel_Exception` |

### Returns

`\New`sheet index

## Set the macros certificate

    setMacrosCertificate(\binary | null $Certificate)

### Parameters

#### $Certificate

`\binary` `null`

## Set the macros code

    setMacrosCode(\binary $MacrosCode)

### Parameters

#### $MacrosCode

`\binary`

string|null

## Set properties

    setProperties(\PHPExcel_DocumentProperties $pValue)

### Parameters

#### $pValue

`\PHPExcel_DocumentProperties`

## store binaries ribbon objects (pictures)

    setRibbonBinObjects($BinObjectsNames, $BinObjectsData)

### Parameters

#### $BinObjectsNames

#### $BinObjectsData

## set ribbon XML data

    setRibbonXMLData($Target, $XMLData)

### Parameters

#### $Target

#### $XMLData

## Set security

    setSecurity(\PHPExcel_DocumentSecurity $pValue)

### Parameters

#### $pValue

`\PHPExcel_DocumentSecurity`

## Check if a sheet with a specified code name already exists

    sheetCodeNameExists(string $pSheetCodeName) : boolean

### Parameters

#### $pSheetCodeName

`string`

Name of the worksheet to check

### Returns

`boolean`

## Check if a sheet with a specified name already exists

    sheetNameExists(string $pSheetName) : boolean

### Parameters

#### $pSheetName

`string`

Name of the worksheet to check

### Returns

`boolean`

## return the extension of a filename.

    _getExtensionOnly($ThePath)

Internal use for a array_map callback (php<5.3 don't like lambda function)

### Parameters

#### $ThePath

### Properties

##

    $_activeSheetIndex : int

##

    $_calculationEngine : \PHPExcel_Calculation

##

    $_cellStyleXfCollection : \PHPExcel_Style[]

##

    $_cellXfCollection : \PHPExcel_Style[]

##

    $_cellXfSupervisor : \PHPExcel_Style

##

    $_hasMacros : bool

##

    $_macrosCertificate : \binary

##

    $_macrosCode : \binary

##

    $_namedRanges : \PHPExcel_NamedRange[]

##

    $_properties : \PHPExcel_DocumentProperties

##

    $_ribbonBinObjects : NULL | array

##

    $_ribbonXMLData : NULL | string

##

    $_security : \PHPExcel_DocumentSecurity

##

    $_uniqueID : string

##

    $_workSheetCollection : \PHPExcel_Worksheet[]