I am generating an excel (.xls) file using PHPExcel (Excel5). When opening the file in excel (2003 and 2010) and trying to use the number formatting shortcuts error always occurs. I tried to format the values through PHPExcel and also the problem. When opening the file and typing number and trying to use also occurs error, it seems that the problem is in the file itself and not in the formatting of the cell when generating. Interestingfact:Prosaccountingnumbers,forexample,ifIusetheshortcuterroroccurs,ifIopentheoptionsbythearrowandselectaformattingitworks.
IranthetestgeneratingthefilewithExcel2007formatting.WhenIgeneratethiswaytheshortcutworkswithexcel2010,howeverinExcel2003Icannotopenit,probablybecauseExcel2007generatesanxlsx.
BelowtheexamplewithExcel5:
<?phpinclude'PHPExcel/PHPExcel.php';include'PHPExcel/PHPExcel/Writer/Excel5.php';$objPHPExcel=newPHPExcel();$objPHPExcel->setActiveSheetIndex(0);$objPHPExcel->getActiveSheet()->SetCellValue('A1','Hello');$objPHPExcel->getActiveSheet()->SetCellValue('B2','world!');$objPHPExcel->getActiveSheet()->SetCellValue('C1','Hello');$objPHPExcel->getActiveSheet()->SetCellValue('D2','world!');$objPHPExcel->getActiveSheet()->getStyle('B1')->getNumberFormat()->setFormatCode("#,##0.00");
$objPHPExcel->getActiveSheet()->setCellValue('B1', '100000.09');
$objPHPExcel->getActiveSheet()->setTitle('Simple');
$objWriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$objWriter->save('teste_excel5_1.xls');
?>