PHPExcel

category | PHPExcel
package | PHPExcel
copyright | Copyright (c) 2006 - 2013 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`

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

## 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`

## 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 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`

## 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`

## 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 properties

    setProperties(\PHPExcel_DocumentProperties $pValue)

### Parameters

#### $pValue

`\PHPExcel_DocumentProperties`

## Set security

    setSecurity(\PHPExcel_DocumentSecurity $pValue)

### Parameters

#### $pValue

`\PHPExcel_DocumentSecurity`

## 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`

### Properties

##

    $_activeSheetIndex : int

##

    $_calculationEngine : \PHPExcel_Calculation

##

    $_cellStyleXfCollection : \PHPExcel_Style[]

##

    $_cellXfCollection : \PHPExcel_Style[]

##

    $_cellXfSupervisor : \PHPExcel_Style

##

    $_namedRanges : \PHPExcel_NamedRange[]

##

    $_properties : \PHPExcel_DocumentProperties

##

    $_security : \PHPExcel_DocumentSecurity

##

    $_uniqueID : string

##

    $_workSheetCollection : \PHPExcel_Worksheet[]