Fatal error when writing with the Excel5 writer

Mar 3, 2009 at 12:38 PM
I just started working with the PHPExcel package and i like it thus far. However, I just stumbled on a problem.
When I loaded from a simple test .xls file, and called the writer function to write the object again there were no problems.
However, when I loaded a more complex .xls file (loading went without problems) with the following function: '=+(O9*G11)-O11', and immediately saving it again I get the following error:
Fatal error: Uncaught exception 'Exception' with message 'Syntax error: +, lookahead: (, current char: 1' in D:\Server\PHPExcel\PHPExcel\Writer\Excel5\Parser.php:1406 Stack trace: #0 D:\Server\PHPExcel\PHPExcel\Writer\Excel5\Parser.php(1312): PHPExcel_Writer_Excel5_Parser->_fact() #1 D:\Server\PHPExcel\PHPExcel\Writer\Excel5\Parser.php(1272): PHPExcel_Writer_Excel5_Parser->_term() #2 D:\Server\PHPExcel\PHPExcel\Writer\Excel5\Parser.php(1220): PHPExcel_Writer_Excel5_Parser->_expression() #3 D:\Server\PHPExcel\PHPExcel\Writer\Excel5\Parser.php(1207): PHPExcel_Writer_Excel5_Parser->_condition() #4 D:\Server\PHPExcel\PHPExcel\Writer\Excel5\Worksheet.php(1145): PHPExcel_Writer_Excel5_Parser->parse('+(O9*G11)-O11') #5 D:\Server\PHPExcel\PHPExcel\Writer\Excel5.php(237): PHPExcel_Writer_Excel5_Worksheet->writeFormula(9, 14, '=+(O9*G11)-O11', Object(PHPExcel_Writer_Excel5_Format)) #6 D:\Server\localhost\view.php(52): PHPExcel_Writer_Excel5->save('../document/exc...') #7 {main} thrown in D:\Server\PHPExcel\PHPExcel\Writer\Excel5\Parser.php on line 1406

It seems that loading the spreadsheet with the formulas works without problems (also proven by the fact that if i output spreadsheet in an html table everything looks ok), but saving it makes the writer choke.

Mar 3, 2009 at 12:53 PM
This is a known bug. Unfortunately, the unary plus operator is not working with PHPExcel_Writer_Excel5. Workaround is to omit the '+' sign.