Some messages 'Notice: Uninitialized string offset:' and so on

Feb 12, 2010 at 10:00 AM
Edited Feb 12, 2010 at 10:02 AM

Hi, i've an excel uploader that gets .xls files and process file to fill a db. Now i'm trying PHPExcel to

provide excel2007 compatibility to my app.

 

I've tried this:

 

 

require_once 'PHPExcel/IOFactory.php';
if (!file_exists("POWERMAC G4 AAA Group Offer.xlsx")) {
exit("Please run 05featuredemo.php first.\n");
}
echo date('H:i:s') . " Load from Excel2007 file<br/>";
$objPHPExcel = PHPExcel_IOFactory::load("POWERMAC G4 AAA Group Offer.xlsx");
echo date('H:i:s') . " Write to Excel200x format<br/>";
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
//phpinfo();
//exit;
$objWriter->save("try.xls");

 

require_once 'PHPExcel/IOFactory.php';

if (!file_exists("thefile.xlsx")) {

exit("failed.\n");

}

 

echo date('H:i:s') . " Load from Excel2007 file<br/>";

$objPHPExcel = PHPExcel_IOFactory::load("thefile.xlsx");

echo date('H:i:s') . " Write to Excel200x format<br/>";

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');

$objWriter->save("try.xls");

 

To convert 2007 to Excel5 before process, but I get:

10:53:57 Load from Excel2007 file
10:53:57 Write to Excel200x format

Notice: Uninitialized string offset: 1 in /.........../public_html/justest/PHPExcel/Writer/Excel5/Parser.php on line 1238

Notice: Uninitialized string offset: 1 in /.........../public_html/justest/PHPExcel/Writer/Excel5/Parser.php on line 1238
_raiseFormulaError message is Formula Error: An unexpected error occured

Fatal error: Uncaught exception 'Exception' with message 'Formula Error: An unexpected error occured' in /.........../public_html/justest/PHPExcel/Calculation.php:3067 Stack trace: #0 /...........public_html/justest/PHPExcel/Calculation.php(2485): PHPExcel_Calculation->_raiseFormulaError('Formula Error: ...') #1 /.....//public_html/justest/PHPExcel/Calculation.php(1935): PHPExcel_Calculation->_parseFormula('?') #2 /.........../public_html/justest/PHPExcel/Calculation.php(1802): PHPExcel_Calculation->_calculateFormulaValue('=?', 'A141', Object(PHPExcel_Cell)) #3 //.........../public_html/justest/PHPExcel/Cell.php(296): PHPExcel_Calculation->calculateCellValue(Object(PHPExcel_Cell), true) #4 /...........public_html/justest/PHPExcel/Writer/Excel5/Worksheet.php(537): PHPExcel_Cell->getCalculatedValue() #5 //...........public_html/justest/PHPExcel/Writer/Excel5.p in /......../public_html/justest/PHPExcel/Calculation.php on line 3067

What's going on?? Thanks.

 

 

Feb 12, 2010 at 10:01 AM

I forgot:

PHP Ver: 5.2.10

PHPExcel ver.: the latest, downloaded today.

Coordinator
Feb 12, 2010 at 1:05 PM

From the error messages displayed, it looks like there's a problem related to formulae within your workbook, specifically with a formula that looks something like:

'=?'

that exists in cell A141

 

I have no idea what a formula of =? should actually do! If I try to enter it in Excel itself, it complains bitterly, and refuses to allow it. What do you expect it to do?