Issue with Absolute coordinate when updating and .xlsx file

Topics: Developer Forum
Mar 20, 2012 at 3:47 PM

Good morning,

 

I'm getting an issue when  trying to  generate an xlsx  from an Excel 2007 existing file.

 

I need to fullfill some entries in the file. When generation the file if always gave me an error


<br />
<b>Fatal error</b>:  Uncaught exception 'Exception' with message 'Invalid cell coordinate REPORT!A4' in /var/www/myPHPframework/phpExcel/PHPExcel/Cell.php:508
Stack trace:
#0 /var/www/myPHPframework/phpExcel/PHPExcel/Cell.php(545): PHPExcel_Cell::coordinateFromString('REPORT!A4')

 

Looking at the error  in the Cell.php  script it comes from the cell reference that includes the sheet name REPORT!

 

I have  updated the  procedure to remove it :

/**
         * Make string coordinate absolute
         *
         * @param       string  $pCoordinateString              e.g. 'A1'
         * @return      string  Absolute coordinate             e.g. '$A$1'
         * @throws      Exception
         */
        public static function absoluteCoordinate($pCoordinateString = 'A1')
        {
                if (strpos($pCoordinateString,':') === false && strpos($pCoordinateString,',') === false) {
                        // Create absolute coordinate
                        $tmp=explode("!",$pCoordinateString);
                        if (count($tmp)==2) {
                                $pCoordinateString=$tmp[1];
                        }
                        list($column, $row) = PHPExcel_Cell::coordinateFromString($pCoordinateString);
                        if ($column[0] == '$')  $column = substr($column,1);
                        if ($row[0] == '$')             $row = substr($row,1);
                        return '$' . $column . '$' . $row;
                } else {
                        throw new Exception("Coordinate string should not be a cell range.");
                }
        }


I have set in bold what i have added that fixes the issue. I'm sorry i did not investigate a lot more on this but if you need more information i can provide the template and code snippet used to generate the xlsx file

Apr 3, 2012 at 5:40 PM

I'm having the same issue. I guess you have to get the latest code from the svn? There hasn't been a release in over a year?