Problem with load function

Topics: User Forum
Jun 17, 2013 at 4:26 PM
Hi,

I have some issues to load an Excel file when I load the internet page i have an error message like this:

Fatal error: Uncaught exception 'Exception' with message 'Cell coordinate must be a range of cells.' in .../Classes/PHPExcel/Worksheet/PageSetup.php:649 Stack trace: #0 .../Classes/PHPExcel/Reader/Excel2007.php(1702): PHPExcel_Worksheet_PageSetup->setPrintArea('#N/A') #1 page.php(39): PHPExcel_Reader_Excel2007->load('../../Excel/...') #2 {main} thrown in .../Classes/PHPExcel/Worksheet/PageSetup.php on line 649

I don't know why the setPrintArea function is the error because I don't use it in my code maybe the load function use it?

Here is an extract of my code:
$objReader = PHPExcel_IOFactory::createReaderForFile("/file.xlsx");

                $objReader->setReadDataOnly(true); 

                $objPHPExcel= $objReader->load("/file.xlsx");
Jun 17, 2013 at 6:14 PM
Line 1702 in reader is : $docSheet->getPageSetup()->setPrintArea(implode(',',$newRangeSets));

This line is called if there is one or more defined print areas.
I do not know what led to have #N/A at this location (a few quick tests show a range valid or not name).

Quick fix: adds a test to this line checking the absence of #N/A in $extractedRange before calling setPrintArea.
(There are more elegant solutions but this should troubleshoot you quickly)

I think that Mark will have a look at this file or know how it manages to get this case
Jun 17, 2013 at 9:55 PM
I update the library i was in the 1.7.8 version and now it function maybe a corrected bug. Thank you for your response ;)