PHPExcel_ReferenceHelper (Singleton)

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

### Methods

## __clone implementation.

    __clone()

Cloning should not be allowed in a Singleton!

### Exceptions

`\PHPExcel_Exception` |

## Compare two cell addresses Intended for use as a Callback function for sorting cell addresses by column and row

    cellReverseSort(string $a, string $b) : integer

Static

### Parameters

#### $a

`string`

First cell to test (e.g. 'AA1')

#### $b

`string`

Second cell to test (e.g. 'Z1')

### Returns

`integer`

## Compare two cell addresses Intended for use as a Callback function for sorting cell addresses by column and row

    cellSort(string $a, string $b) : integer

Static

### Parameters

#### $a

`string`

First cell to test (e.g. 'AA1')

#### $b

`string`

Second cell to test (e.g. 'Z1')

### Returns

`integer`

## Compare two column addresses Intended for use as a Callback function for reverse sorting column addresses by column

    columnReverseSort(string $a, string $b) : integer

Static

### Parameters

#### $a

`string`

First column to test (e.g. 'AA')

#### $b

`string`

Second column to test (e.g. 'Z')

### Returns

`integer`

## Compare two column addresses Intended for use as a Callback function for sorting column addresses by column

    columnSort(string $a, string $b) : integer

Static

### Parameters

#### $a

`string`

First column to test (e.g. 'AA')

#### $b

`string`

Second column to test (e.g. 'Z')

### Returns

`integer`

## Get an instance of this class

    getInstance() : \PHPExcel_ReferenceHelper

Static

### Returns

`\PHPExcel_ReferenceHelper`

## Insert a new column or row, updating all possible related data

    insertNewBefore(string $pBefore, integer $pNumCols, integer $pNumRows, \PHPExcel_Worksheet $pSheet)

### Parameters

#### $pBefore

`string`

Insert before this cell address (e.g. 'A1')

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

#### $pSheet

`\PHPExcel_Worksheet`

The worksheet that we're editing

### Exceptions

`\PHPExcel_Exception` |

## Update cell reference

    updateCellReference(string $pCellRange, int $pBefore, int $pNumCols, int $pNumRows) : string

### Parameters

#### $pCellRange

`string`

Cell range

#### $pBefore

`int`

Insert before this one

#### $pNumCols

`int`

Number of columns to increment

#### $pNumRows

`int`

Number of rows to increment

### Exceptions

`\PHPExcel_Exception` |

### Returns

`string`Updated cell range

## Update references within formulas

    updateFormulaReferences(string $pFormula, int $pBefore, int $pNumCols, int $pNumRows, string $sheetName) : string

### Parameters

#### $pFormula

`string`

Formula to update

#### $pBefore

`int`

Insert before this one

#### $pNumCols

`int`

Number of columns to insert

#### $pNumRows

`int`

Number of rows to insert

#### $sheetName

`string`

Worksheet name/title

### Exceptions

`\PHPExcel_Exception` |

### Returns

`string`Updated formula

## Update named formulas (i.e.

    updateNamedFormulas(\PHPExcel $pPhpExcel, string $oldName, string $newName)

containing worksheet references / named ranges)

### Parameters

#### $pPhpExcel

`\PHPExcel`

Object to update

#### $oldName

`string`

Old name (name to replace)

#### $newName

`string`

New name

## Create a new PHPExcel_ReferenceHelper

    __construct()

## Update column dimensions when inserting/deleting rows/columns

    _adjustColumnDimensions(\PHPExcel_Worksheet $pSheet, string $pBefore, integer $beforeColumnIndex, integer $pNumCols, integer $beforeRow, integer $pNumRows)

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

The worksheet that we're editing

#### $pBefore

`string`

Insert/Delete before this cell address (e.g. 'A1')

#### $beforeColumnIndex

`integer`

Index number of the column we're inserting/deleting before

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

#### $beforeRow

`integer`

Number of the row we're inserting/deleting before

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

## Update cell comments when inserting/deleting rows/columns

    _adjustComments(\PHPExcel_Worksheet $pSheet, string $pBefore, integer $beforeColumnIndex, integer $pNumCols, integer $beforeRow, integer $pNumRows)

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

The worksheet that we're editing

#### $pBefore

`string`

Insert/Delete before this cell address (e.g. 'A1')

#### $beforeColumnIndex

`integer`

Index number of the column we're inserting/deleting before

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

#### $beforeRow

`integer`

Number of the row we're inserting/deleting before

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

## Update data validations when inserting/deleting rows/columns

    _adjustDataValidations(\PHPExcel_Worksheet $pSheet, string $pBefore, integer $beforeColumnIndex, integer $pNumCols, integer $beforeRow, integer $pNumRows)

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

The worksheet that we're editing

#### $pBefore

`string`

Insert/Delete before this cell address (e.g. 'A1')

#### $beforeColumnIndex

`integer`

Index number of the column we're inserting/deleting before

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

#### $beforeRow

`integer`

Number of the row we're inserting/deleting before

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

## Update hyperlinks when inserting/deleting rows/columns

    _adjustHyperlinks(\PHPExcel_Worksheet $pSheet, string $pBefore, integer $beforeColumnIndex, integer $pNumCols, integer $beforeRow, integer $pNumRows)

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

The worksheet that we're editing

#### $pBefore

`string`

Insert/Delete before this cell address (e.g. 'A1')

#### $beforeColumnIndex

`integer`

Index number of the column we're inserting/deleting before

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

#### $beforeRow

`integer`

Number of the row we're inserting/deleting before

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

## Update merged cells when inserting/deleting rows/columns

    _adjustMergeCells(\PHPExcel_Worksheet $pSheet, string $pBefore, integer $beforeColumnIndex, integer $pNumCols, integer $beforeRow, integer $pNumRows)

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

The worksheet that we're editing

#### $pBefore

`string`

Insert/Delete before this cell address (e.g. 'A1')

#### $beforeColumnIndex

`integer`

Index number of the column we're inserting/deleting before

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

#### $beforeRow

`integer`

Number of the row we're inserting/deleting before

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

## Update page breaks when inserting/deleting rows/columns

    _adjustPageBreaks(\PHPExcel_Worksheet $pSheet, string $pBefore, integer $beforeColumnIndex, integer $pNumCols, integer $beforeRow, integer $pNumRows)

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

The worksheet that we're editing

#### $pBefore

`string`

Insert/Delete before this cell address (e.g. 'A1')

#### $beforeColumnIndex

`integer`

Index number of the column we're inserting/deleting before

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

#### $beforeRow

`integer`

Number of the row we're inserting/deleting before

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

## Update protected cells when inserting/deleting rows/columns

    _adjustProtectedCells(\PHPExcel_Worksheet $pSheet, string $pBefore, integer $beforeColumnIndex, integer $pNumCols, integer $beforeRow, integer $pNumRows)

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

The worksheet that we're editing

#### $pBefore

`string`

Insert/Delete before this cell address (e.g. 'A1')

#### $beforeColumnIndex

`integer`

Index number of the column we're inserting/deleting before

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

#### $beforeRow

`integer`

Number of the row we're inserting/deleting before

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

## Update row dimensions when inserting/deleting rows/columns

    _adjustRowDimensions(\PHPExcel_Worksheet $pSheet, string $pBefore, integer $beforeColumnIndex, integer $pNumCols, integer $beforeRow, integer $pNumRows)

### Parameters

#### $pSheet

`\PHPExcel_Worksheet`

The worksheet that we're editing

#### $pBefore

`string`

Insert/Delete before this cell address (e.g. 'A1')

#### $beforeColumnIndex

`integer`

Index number of the column we're inserting/deleting before

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

#### $beforeRow

`integer`

Number of the row we're inserting/deleting before

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

## Update cell range

    _updateCellRange(string $pCellRange, int $pBefore, int $pNumCols, int $pNumRows) : string

### Parameters

#### $pCellRange

`string`

Cell range (e.g. 'B2:D4', 'B:C' or '2:3')

#### $pBefore

`int`

Insert before this one

#### $pNumCols

`int`

Number of columns to increment

#### $pNumRows

`int`

Number of rows to increment

### Exceptions

`\PHPExcel_Exception` |

### Returns

`string`Updated cell range

## Update single cell reference

    _updateSingleCellReference(string $pCellReference, int $pBefore, int $pNumCols, int $pNumRows) : string

### Parameters

#### $pCellReference

`string`

Single cell reference

#### $pBefore

`int`

Insert before this one

#### $pNumCols

`int`

Number of columns to increment

#### $pNumRows

`int`

Number of rows to increment

### Exceptions

`\PHPExcel_Exception` |

### Returns

`string`Updated cell reference

## Test whether a cell address falls within a defined range of cells

    cellAddressInDeleteRange(string $cellAddress, integer $beforeRow, integer $pNumRows, integer $beforeColumnIndex, integer $pNumCols) : boolean

Static

### Parameters

#### $cellAddress

`string`

Address of the cell we're testing

#### $beforeRow

`integer`

Number of the row we're inserting/deleting before

#### $pNumRows

`integer`

Number of rows to insert/delete (negative values indicate deletion)

#### $beforeColumnIndex

`integer`

Index number of the column we're inserting/deleting before

#### $pNumCols

`integer`

Number of columns to insert/delete (negative values indicate deletion)

### Returns

`boolean`

### Properties

##

    $_instance : \PHPExcel_ReferenceHelper

### Constants

## REFHELPER_REGEXP_CELLRANGE

    REFHELPER_REGEXP_CELLRANGE

## Regular Expressions

    REFHELPER_REGEXP_CELLREF

## REFHELPER_REGEXP_COLRANGE

    REFHELPER_REGEXP_COLRANGE

## REFHELPER_REGEXP_ROWRANGE

    REFHELPER_REGEXP_ROWRANGE