A pure PHP library for reading and writing spreadsheet file. https://github.com/PHPOffice/PHPExcel
Home page: http://phpexcel.codeplex.com/wikipage?title=Examples
Use 01simple-download-xls.php if you want output to a client’s web browser (Excel5)
If you gotn this error: “exception ‘PHPExcel_Calculation_Exception’ with message”.
Add this
$objWriter->setPreCalculateFormulas(false);
row before save:
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
//$objWriter->setPreCalculateFormulas(false);
$objWriter->save('php://output');
info from here: https://phpexcel.codeplex.com/discussions/237881
Set bold the row, set width:
$objPHPExcel->getActiveSheet()->getStyle('A1:J1')->getFont()->setBold(true);
$objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(30);
*************************
Hide notice: “Notice: Undefined property: PHPExcel_Calculation::$_savedPrecision”
Replace this function in calculation.php line 1739
https://phpexcel.codeplex.com/workitem/20797
public function __destruct() {
if ($this->_savedPrecision != ini_get('precision')) {
ini_set('precision',$this->_savedPrecision);
}
}
for:
//checking if the property exists with isset
public function __destruct() {
if(isset($this->_savedPrecision)){
if ($this->_savedPrecision != ini_get('precision')) {
ini_set('precision',$this->_savedPrecision);
}
}
}