PHPExcel
[ class tree: PHPExcel ] [ index: PHPExcel ] [ all elements ]

Source for file ReferenceHelper.php

Documentation is available at ReferenceHelper.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2009 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel
  23.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.0, 2009-08-10
  26.  */
  27.  
  28.  
  29. /** PHPExcel root directory */
  30. if (!defined('PHPEXCEL_ROOT')) {
  31.     /**
  32.      * @ignore
  33.      */
  34.     define('PHPEXCEL_ROOT'dirname(__FILE__'/../');
  35. }
  36.  
  37. /** PHPExcel_Worksheet */
  38. require_once PHPEXCEL_ROOT 'PHPExcel/Worksheet.php';
  39.  
  40. /** PHPExcel_Cell */
  41. require_once PHPEXCEL_ROOT 'PHPExcel/Cell.php';
  42.  
  43. /** PHPExcel_Cell_DataType */
  44. require_once PHPEXCEL_ROOT 'PHPExcel/Cell/DataType.php';
  45.  
  46. /** PHPExcel_Style */
  47. require_once PHPEXCEL_ROOT 'PHPExcel/Style.php';
  48.  
  49. /** PHPExcel_Worksheet_Drawing */
  50. require_once PHPEXCEL_ROOT 'PHPExcel/Worksheet/Drawing.php';
  51.  
  52. /** PHPExcel_Calculation_FormulaParser */
  53. require_once PHPEXCEL_ROOT 'PHPExcel/Calculation/FormulaParser.php';
  54.  
  55. /** PHPExcel_Calculation_FormulaToken */
  56. require_once PHPEXCEL_ROOT 'PHPExcel/Calculation/FormulaToken.php';
  57.  
  58.  
  59. /**
  60.  * PHPExcel_ReferenceHelper (Singleton)
  61.  *
  62.  * @category   PHPExcel
  63.  * @package    PHPExcel
  64.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  65.  */
  66. {
  67.     /**
  68.      * Instance of this class
  69.      *
  70.      * @var PHPExcel_ReferenceHelper 
  71.      */
  72.     private static $_instance;
  73.  
  74.     /**
  75.      * Get an instance of this class
  76.      *
  77.      * @return PHPExcel_ReferenceHelper 
  78.      */
  79.     public static function getInstance({
  80.         if (!isset(self::$_instance|| is_null(self::$_instance)) {
  81.             self::$_instance new PHPExcel_ReferenceHelper();
  82.         }
  83.  
  84.         return self::$_instance;
  85.     }
  86.  
  87.     /**
  88.      * Create a new PHPExcel_Calculation
  89.      */
  90.     protected function __construct({
  91.     }
  92.  
  93.     /**
  94.      * Insert a new column, updating all possible related data
  95.      *
  96.      * @param     int    $pBefore    Insert before this one
  97.      * @param     int    $pNumCols    Number of columns to insert
  98.      * @param     int    $pNumRows    Number of rows to insert
  99.      * @throws     Exception
  100.      */
  101.     public function insertNewBefore($pBefore 'A1'$pNumCols 0$pNumRows 0PHPExcel_Worksheet $pSheet null{
  102.         // Get a copy of the cell collection
  103.         /*$aTemp = $pSheet->getCellCollection();
  104.         $aCellCollection = array();
  105.         foreach ($aTemp as $key => $value) {
  106.             $aCellCollection[$key] = clone $value;
  107.         }*/
  108.         $aCellCollection $pSheet->getCellCollection();
  109.  
  110.         // Get coordinates of $pBefore
  111.         $beforeColumn     'A';
  112.         $beforeRow        1;
  113.         list($beforeColumn$beforeRowPHPExcel_Cell::coordinateFromString$pBefore );
  114.  
  115.  
  116.         // Clear cells if we are removing columns or rows
  117.         $highestColumn     $pSheet->getHighestColumn();
  118.         $highestRow     $pSheet->getHighestRow();
  119.  
  120.         // 1. Clear column strips if we are removing columns
  121.         if ($pNumCols && PHPExcel_Cell::columnIndexFromString($beforeColumn$pNumCols 0{
  122.             for ($i 1$i <= $highestRow 1++$i{
  123.                 for ($j PHPExcel_Cell::columnIndexFromString($beforeColumn$pNumCols$j <= PHPExcel_Cell::columnIndexFromString($beforeColumn2++$j{
  124.                     $coordinate PHPExcel_Cell::stringFromColumnIndex($j$i;
  125.                     $pSheet->removeConditionalStyles($coordinate);
  126.                     if ($pSheet->cellExists($coordinate)) {
  127.                         $pSheet->getCell($coordinate)->setValueExplicit(''PHPExcel_Cell_DataType::TYPE_NULL);
  128.                         $pSheet->getCell($coordinate)->setXfIndex(0);
  129.                     }
  130.                 }
  131.             }
  132.         }
  133.  
  134.         // 2. Clear row strips if we are removing rows
  135.         if ($pNumRows && $beforeRow $pNumRows 0{
  136.             for ($i PHPExcel_Cell::columnIndexFromString($beforeColumn1$i <= PHPExcel_Cell::columnIndexFromString($highestColumn1++$i{
  137.                 for ($j $beforeRow $pNumRows$j <= $beforeRow 1++$j{
  138.                     $coordinate PHPExcel_Cell::stringFromColumnIndex($i$j;
  139.                     $pSheet->removeConditionalStyles($coordinate);
  140.                     if ($pSheet->cellExists($coordinate)) {
  141.                         $pSheet->getCell($coordinate)->setValueExplicit(''PHPExcel_Cell_DataType::TYPE_NULL);
  142.                         $pSheet->getCell($coordinate)->setXfIndex(0);
  143.                     }
  144.                 }
  145.             }
  146.         }
  147.  
  148.  
  149.         // Loop through cells, bottom-up, and change cell coordinates
  150.         while ( ($cell ($pNumCols || $pNumRows 0array_shift($aCellCollectionarray_pop($aCellCollection)) ) {
  151.             // New coordinates
  152.             $newCoordinates PHPExcel_Cell::stringFromColumnIndexPHPExcel_Cell::columnIndexFromString($cell->getColumn()) $pNumCols ($cell->getRow($pNumRows);
  153.  
  154.             // Should the cell be updated? Move value and cellXf index from one cell to another.
  155.             if (
  156.                     (PHPExcel_Cell::columnIndexFromString$cell->getColumn() ) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)) &&
  157.                      ($cell->getRow(>= $beforeRow)
  158.                  {
  159.  
  160.                 // Update cell styles
  161.                 $pSheet->getCell($newCoordinates)->setXfIndex($cell->getXfIndex());
  162.                 $cell->setXfIndex(0);
  163.  
  164.                 // Insert this cell at its new location
  165.                 if ($cell->getDataType(== PHPExcel_Cell_DataType::TYPE_FORMULA{
  166.                     // Formula should be adjusted
  167.                     $pSheet->setCellValue(
  168.                           $newCoordinates
  169.                         $this->updateFormulaReferences($cell->getValue()$pBefore$pNumCols$pNumRows)
  170.                     );
  171.                 else {
  172.                     // Formula should not be adjusted
  173.                     $pSheet->setCellValue($newCoordinates$cell->getValue());
  174.                 }
  175.  
  176.                 // Clear the original cell
  177.                 $pSheet->setCellValue($cell->getCoordinate()'');
  178.             }
  179.         }
  180.  
  181.  
  182.         // Duplicate styles for the newly inserted cells
  183.         $highestColumn     $pSheet->getHighestColumn();
  184.         $highestRow     $pSheet->getHighestRow();
  185.  
  186.         if ($pNumCols && PHPExcel_Cell::columnIndexFromString($beforeColumn0{
  187.             for ($i $beforeRow$i <= $highestRow 1++$i{
  188.  
  189.                 // Style
  190.                 $coordinate PHPExcel_Cell::stringFromColumnIndexPHPExcel_Cell::columnIndexFromString($beforeColumn$i;
  191.                 if ($pSheet->cellExists($coordinate)) {
  192.                     $xfIndex $pSheet->getCell($coordinate)->getXfIndex();
  193.                     $conditionalStyles $pSheet->conditionalStylesExists($coordinate?
  194.                         $pSheet->getConditionalStyles($coordinatefalse;
  195.                     for ($j PHPExcel_Cell::columnIndexFromString($beforeColumn1$j <= PHPExcel_Cell::columnIndexFromString($beforeColumn$pNumCols++$j{
  196.                         $pSheet->getCellByColumnAndRow($j$i)->setXfIndex($xfIndex);
  197.                         if ($conditionalStyles{
  198.                             $cloned array();
  199.                             foreach ($conditionalStyles as $conditionalStyle{
  200.                                 $cloned[clone $conditionalStyle;
  201.                             }
  202.                             $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($j$i$cloned);
  203.                         }
  204.                     }
  205.                 }
  206.  
  207.             }
  208.         }
  209.  
  210.         if ($pNumRows && $beforeRow 0{
  211.             for ($i PHPExcel_Cell::columnIndexFromString($beforeColumn1$i <= PHPExcel_Cell::columnIndexFromString($highestColumn1++$i{
  212.  
  213.                 // Style
  214.                 $coordinate PHPExcel_Cell::stringFromColumnIndex($i($beforeRow 1);
  215.                 if ($pSheet->cellExists($coordinate)) {
  216.                     $xfIndex $pSheet->getCell($coordinate)->getXfIndex();
  217.                     $conditionalStyles $pSheet->conditionalStylesExists($coordinate?
  218.                         $pSheet->getConditionalStyles($coordinatefalse;
  219.                     for ($j $beforeRow$j <= $beforeRow $pNumRows++$j{
  220.                         $pSheet->getCell(PHPExcel_Cell::stringFromColumnIndex($i$j)->setXfIndex($xfIndex);
  221.                         if ($conditionalStyles{
  222.                             $cloned array();
  223.                             foreach ($conditionalStyles as $conditionalStyle{
  224.                                 $cloned[clone $conditionalStyle;
  225.                             }
  226.                             $pSheet->setConditionalStyles(PHPExcel_Cell::stringFromColumnIndex($i$j$cloned);
  227.                         }
  228.                     }
  229.                 }
  230.             }
  231.         }
  232.  
  233.  
  234.         // Update worksheet: column dimensions
  235.         $aColumnDimensions array_reverse($pSheet->getColumnDimensions()true);
  236.         if (count($aColumnDimensions0{
  237.             foreach ($aColumnDimensions as $objColumnDimension{
  238.                 $newReference $this->updateCellReference($objColumnDimension->getColumnIndex('1'$pBefore$pNumCols$pNumRows);
  239.                 list($newReferencePHPExcel_Cell::coordinateFromString($newReference);
  240.                 if ($objColumnDimension->getColumnIndex(!= $newReference{
  241.                     $objColumnDimension->setColumnIndex($newReference);
  242.                 }
  243.             }
  244.             $pSheet->refreshColumnDimensions();
  245.         }
  246.  
  247.  
  248.         // Update worksheet: row dimensions
  249.         $aRowDimensions array_reverse($pSheet->getRowDimensions()true);
  250.         if (count($aRowDimensions0{
  251.             foreach ($aRowDimensions as $objRowDimension{
  252.                 $newReference $this->updateCellReference('A' $objRowDimension->getRowIndex()$pBefore$pNumCols$pNumRows);
  253.                 list($newReferencePHPExcel_Cell::coordinateFromString($newReference);
  254.                 if ($objRowDimension->getRowIndex(!= $newReference{
  255.                     $objRowDimension->setRowIndex($newReference);
  256.                 }
  257.             }
  258.             $pSheet->refreshRowDimensions();
  259.  
  260.             $copyDimension $pSheet->getRowDimension($beforeRow 1);
  261.             for ($i $beforeRow$i <= $beforeRow $pNumRows++$i{
  262.                 $newDimension $pSheet->getRowDimension($i);
  263.                 $newDimension->setRowHeight($copyDimension->getRowHeight());
  264.                 $newDimension->setVisible($copyDimension->getVisible());
  265.                 $newDimension->setOutlineLevel($copyDimension->getOutlineLevel());
  266.                 $newDimension->setCollapsed($copyDimension->getCollapsed());
  267.             }
  268.         }
  269.  
  270.  
  271.         // Update worksheet: breaks
  272.         $aBreaks array_reverse($pSheet->getBreaks()true);
  273.         foreach ($aBreaks as $key => $value{
  274.             $newReference $this->updateCellReference($key$pBefore$pNumCols$pNumRows);
  275.             if ($key != $newReference{
  276.                 $pSheet->setBreak$newReference$value );
  277.                 $pSheet->setBreak$keyPHPExcel_Worksheet::BREAK_NONE );
  278.             }
  279.         }
  280.  
  281.  
  282.         // Update worksheet: hyperlinks
  283.         $aHyperlinkCollection array_reverse($pSheet->getHyperlinkCollection()true);
  284.         foreach ($aHyperlinkCollection as $key => $value{
  285.             $newReference $this->updateCellReference($key$pBefore$pNumCols$pNumRows);
  286.             if ($key != $newReference{
  287.                 $pSheet->setHyperlink$newReference$value );
  288.                 $pSheet->setHyperlink$keynull );
  289.             }
  290.         }
  291.  
  292.  
  293.         // Update worksheet: data validations
  294.         $aDataValidationCollection array_reverse($pSheet->getDataValidationCollection()true);
  295.         foreach ($aDataValidationCollection as $key => $value{
  296.             $newReference $this->updateCellReference($key$pBefore$pNumCols$pNumRows);
  297.             if ($key != $newReference{
  298.                 $pSheet->setDataValidation$newReference$value );
  299.                 $pSheet->setDataValidation$keynull );
  300.             }
  301.         }
  302.  
  303.  
  304.         // Update worksheet: merge cells
  305.         $aMergeCells array_reverse($pSheet->getMergeCells()true);
  306.         foreach ($aMergeCells as $key => $value{
  307.             $newReference $this->updateCellReference($key$pBefore$pNumCols$pNumRows);
  308.             if ($key != $newReference{
  309.                 $pSheet->mergeCells$newReference );
  310.                 $pSheet->unmergeCells$key );
  311.             }
  312.         }
  313.  
  314.  
  315.         // Update worksheet: protected cells
  316.         $aProtectedCells array_reverse($pSheet->getProtectedCells()true);
  317.         foreach ($aProtectedCells as $key => $value{
  318.             $newReference $this->updateCellReference($key$pBefore$pNumCols$pNumRows);
  319.             if ($key != $newReference{
  320.                 $pSheet->protectCells$newReference$valuetrue );
  321.                 $pSheet->unprotectCells$key );
  322.             }
  323.         }
  324.  
  325.  
  326.         // Update worksheet: autofilter
  327.         if ($pSheet->getAutoFilter(!= ''{
  328.             $pSheet->setAutoFilter$this->updateCellReference($pSheet->getAutoFilter()$pBefore$pNumCols$pNumRows) );
  329.         }
  330.  
  331.  
  332.         // Update worksheet: freeze pane
  333.         if ($pSheet->getFreezePane(!= ''{
  334.             $pSheet->freezePane$this->updateCellReference($pSheet->getFreezePane()$pBefore$pNumCols$pNumRows) );
  335.         }
  336.  
  337.  
  338.         // Page setup
  339.         if ($pSheet->getPageSetup()->isPrintAreaSet()) {
  340.             $pSheet->getPageSetup()->setPrintArea$this->updateCellReference($pSheet->getPageSetup()->getPrintArea()$pBefore$pNumCols$pNumRows) );
  341.         }
  342.  
  343.  
  344.         // Update worksheet: drawings
  345.         $aDrawings $pSheet->getDrawingCollection();
  346.         foreach ($aDrawings as $objDrawing{
  347.             $newReference $this->updateCellReference($objDrawing->getCoordinates()$pBefore$pNumCols$pNumRows);
  348.             if ($objDrawing->getCoordinates(!= $newReference{
  349.                 $objDrawing->setCoordinates($newReference);
  350.             }
  351.         }
  352.  
  353.  
  354.         // Update workbook: named ranges
  355.         if (count($pSheet->getParent()->getNamedRanges()) 0{
  356.             foreach ($pSheet->getParent()->getNamedRanges(as $namedRange{
  357.                 if ($namedRange->getWorksheet()->getHashCode(== $pSheet->getHashCode()) {
  358.                     $namedRange->setRange(
  359.                         $this->updateCellReference($namedRange->getRange()$pBefore$pNumCols$pNumRows)
  360.                     );
  361.                 }
  362.             }
  363.         }
  364.  
  365.         // Garbage collect
  366.         $pSheet->garbageCollect();
  367.     }
  368.  
  369.     /**
  370.      * Update references within formulas
  371.      *
  372.      * @param     string    $pFormula    Formula to update
  373.      * @param     int        $pBefore    Insert before this one
  374.      * @param     int        $pNumCols    Number of columns to insert
  375.      * @param     int        $pNumRows    Number of rows to insert
  376.      * @return     string    Updated formula
  377.      * @throws     Exception
  378.      */
  379.     public function updateFormulaReferences($pFormula ''$pBefore 'A1'$pNumCols 0$pNumRows 0{
  380.         // Formula stack
  381.         $executableFormulaArray array();
  382.  
  383.         // Parse formula into a tree of tokens
  384.         $tokenisedFormula PHPExcel_Calculation::getInstance()->parseFormula($pFormula);
  385.         $newCellTokens $cellTokens array();
  386.         //    Build the translation table of cell tokens
  387.         foreach($tokenisedFormula as $token{
  388.             if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i'$token$matches)) {
  389.                  $newCellTokens[$this->updateCellReference($token$pBefore$pNumCols$pNumRows);
  390.                 $cellTokens['/'.$token.'/';
  391.             }
  392.         }
  393.  
  394.         //    Update cell references in the formula
  395.         $formulaBlocks explode('"',$pFormula);
  396.         $i 0;
  397.         foreach($formulaBlocks as $formulaBlockKey => $formulaBlock{
  398.             //    Only count/replace in alternate array entries
  399.             if (($i++ % 2== 0{
  400.                 $formulaBlocks[$formulaBlockKeypreg_replace($cellTokens,$newCellTokens,$formulaBlock);
  401.             }
  402.         }
  403.         //    Then rebuild the formula string
  404.         return implode('"',$formulaBlocks);
  405.     }
  406.  
  407.     /**
  408.      * Update cell reference
  409.      *
  410.      * @param     string    $pCellRange            Cell range
  411.      * @param     int        $pBefore            Insert before this one
  412.      * @param     int        $pNumCols            Number of columns to increment
  413.      * @param     int        $pNumRows            Number of rows to increment
  414.      * @return     string    Updated cell range
  415.      * @throws     Exception
  416.      */
  417.     public function updateCellReference($pCellRange 'A1'$pBefore 'A1'$pNumCols 0$pNumRows 0{
  418.         // Is it in another worksheet? Will not have to update anything.
  419.         if (strpos($pCellRange"!"!== false{
  420.             return $pCellRange;
  421.         // Is it a range or a single cell?
  422.         elseif (strpos($pCellRange':'=== false && strpos($pCellRange','=== false{
  423.             // Single cell
  424.             return $this->_updateSingleCellReference($pCellRange$pBefore$pNumCols$pNumRows);
  425.         else if (strpos($pCellRange':'!== false || strpos($pCellRange','!== false{
  426.             // Range
  427.             return $this->_updateCellRange($pCellRange$pBefore$pNumCols$pNumRows);
  428.         else {
  429.             // Return original
  430.             return $pCellRange;
  431.         }
  432.     }
  433.  
  434.     /**
  435.      * Update named formulas (i.e. containing worksheet references / named ranges)
  436.      *
  437.      * @param PHPExcel $pPhpExcel    Object to update
  438.      * @param string $oldName        Old name (name to replace)
  439.      * @param string $newName        New name
  440.      */
  441.     public function updateNamedFormulas(PHPExcel $pPhpExcel$oldName ''$newName ''{
  442.         foreach ($pPhpExcel->getWorksheetIterator(as $sheet{
  443.             foreach ($sheet->getCellCollection(falseas $cell{
  444.                 if (!is_null($cell&& $cell->getDataType(== PHPExcel_Cell_DataType::TYPE_FORMULA{
  445.                     $formula $cell->getValue();
  446.                     if (strpos($formula$oldName!== false{
  447.                         $formula str_replace("'" $oldName "'!""'" $newName "'!"$formula);
  448.                         $formula str_replace($oldName "!"$newName "!"$formula);
  449.                         $cell->setValueExplicit($formulaPHPExcel_Cell_DataType::TYPE_FORMULA);
  450.                     }
  451.                 }
  452.             }
  453.         }
  454.     }
  455.  
  456.     /**
  457.      * Update cell range
  458.      *
  459.      * @param     string    $pCellRange            Cell range
  460.      * @param     int        $pBefore            Insert before this one
  461.      * @param     int        $pNumCols            Number of columns to increment
  462.      * @param     int        $pNumRows            Number of rows to increment
  463.      * @return     string    Updated cell range
  464.      * @throws     Exception
  465.      */
  466.     private function _updateCellRange($pCellRange 'A1:A1'$pBefore 'A1'$pNumCols 0$pNumRows 0{
  467.         if (strpos($pCellRange,':'!== false || strpos($pCellRange','!== false{
  468.             // Update range
  469.             $range PHPExcel_Cell::splitRange($pCellRange);
  470.             for ($i 0$i count($range)$i++{
  471.                 for ($j 0$j count($range[$i])$j++{
  472.                     $range[$i][$j$this->_updateSingleCellReference($range[$i][$j]$pBefore$pNumCols$pNumRows);
  473.                 }
  474.             }
  475.  
  476.             // Recreate range string
  477.             return PHPExcel_Cell::buildRange($range);
  478.         else {
  479.             throw new Exception("Only cell ranges may be passed to this method.");
  480.         }
  481.     }
  482.  
  483.     /**
  484.      * Update single cell reference
  485.      *
  486.      * @param     string    $pCellReference        Single cell reference
  487.      * @param     int        $pBefore            Insert before this one
  488.      * @param     int        $pNumCols            Number of columns to increment
  489.      * @param     int        $pNumRows            Number of rows to increment
  490.      * @return     string    Updated cell reference
  491.      * @throws     Exception
  492.      */
  493.     private function _updateSingleCellReference($pCellReference 'A1'$pBefore 'A1'$pNumCols 0$pNumRows 0{
  494.         if (strpos($pCellReference':'=== false && strpos($pCellReference','=== false{
  495.             // Get coordinates of $pBefore
  496.             $beforeColumn     'A';
  497.             $beforeRow        1;
  498.             list($beforeColumn$beforeRowPHPExcel_Cell::coordinateFromString$pBefore );
  499.  
  500.             // Get coordinates
  501.             $newColumn     'A';
  502.             $newRow     1;
  503.             list($newColumn$newRowPHPExcel_Cell::coordinateFromString$pCellReference );
  504.  
  505.             // Make sure the reference can be used
  506.             if ($newColumn == '' && $newRow == '')
  507.             {
  508.                 return $pCellReference;
  509.             }
  510.  
  511.             // Verify which parts should be updated
  512.             $updateColumn (PHPExcel_Cell::columnIndexFromString($newColumn>= PHPExcel_Cell::columnIndexFromString($beforeColumn))
  513.                             && (strpos($newColumn'$'=== false)
  514.                             && (strpos($beforeColumn'$'=== false);
  515.  
  516.             $updateRow ($newRow >= $beforeRow)
  517.                             && (strpos($newRow'$'=== false)
  518.                             && (strpos($beforeRow'$'=== false);
  519.  
  520.             // Create new column reference
  521.             if ($updateColumn{
  522.                 $newColumn     PHPExcel_Cell::stringFromColumnIndexPHPExcel_Cell::columnIndexFromString($newColumn$pNumCols );
  523.             }
  524.  
  525.             // Create new row reference
  526.             if ($updateRow{
  527.                 $newRow     $newRow $pNumRows;
  528.             }
  529.  
  530.             // Return new reference
  531.             return $newColumn $newRow;
  532.         else {
  533.             throw new Exception("Only single cell references may be passed to this method.");
  534.         }
  535.     }
  536.  
  537.     /**
  538.      * __clone implementation. Cloning should not be allowed in a Singleton!
  539.      *
  540.      * @throws    Exception
  541.      */
  542.     public final function __clone({
  543.         throw new Exception("Cloning a Singleton is not allowed!");
  544.     }
  545. }

Documentation generated on Mon, 10 Aug 2009 08:07:33 +0200 by phpDocumentor 1.4.1