Open narainsagar opened 9 years ago
Have you managed to find a solution to this? I am facing the same problem.
Yeah, I did with just removed the "Pound" sign and it works fine.. Though if we remove the space between "Pound" and "number" it also works fine... Just make sure that the cell value should be string(text) with no spaces between, do apply trim() if it has spaces.... That's it. I didn't find any best solution so i did with that trick.. Hope this may helps you.
Thanks.
Hi, While exporting html to xlsx or downloading,All of the cells with numbers show an error message next to them on Excel. When I read the error message it says that "they are formatted as text or preceded by an apostrophe".
Here is screenshot attached!
It just looks a bit ugly, that's all..
Why is that occurs?, How to fix this?
What i did was quite simple here is my sample code:
if(!is_dir( TMP_FILES )) { mkdir( TMP_FILES, 0777 ); } //TMP_FILES == '../temp/'; $htmlfile = TMP_FILES . $filename . '.html'; file_put_contents($htmlfile, $content);
$objReader = new PHPExcel_Reader_HTML; $objPHPExcel = $objReader->load($htmlfile); // load .html file
// Set properties $objPHPExcel->getProperties()->setCreator("Hello World"); $objPHPExcel->getProperties()->setLastModifiedBy("Hello World"); $objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Document Report"); $objPHPExcel->getProperties()->setSubject("XLSX Report"); $objPHPExcel->getProperties()->setDescription("XLSX report document for Office 2007");
$excelFile = TMP_FILES . $filename . '.xlsx'; // excel file to generate. // Creates a writer to output the $objPHPExcel's content $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007'); $objWriter->save($excelFile); unlink($htmlfile); // remove .html file
Though everything else works fine. and I am using Windows 8.1 Pro Office 2013
Thanks in advance!