Phpexcel Import and export an Excel file instance
public static function Exportexcel ($fileName, $displayFields, $exportList)
{
$objExcel = new Phpexcel ();
Set document property
$objWriter = Phpexcel_iofactory::createwriter ($objExcel, ' Excel2007 ');
$objActSheet = $objExcel->getactivesheet ();
$key = Ord ("A");
foreach ($displayFields as $filedValue)
{
$colum = Chr ($key);
$objActSheet->setcellvalue ($colum. ' 1 ', $filedValue);
$key + = 1;
}
$column = 2;
foreach ($exportList as $key = = $rows) {
$span = Ord ("A");
foreach ($rows as $keyName = = $value) {
$j = Chr ($span);
$objActSheet->setcellvalue ($j. $column, $value);
$span + +;
}
$column + +;
}
//*************************************
$outfile = $fileName. ". XLS ";
Export to Exploer
Header ("Content-type:application/force-download");
Header ("Content-type:application/octet-stream");
Header ("Content-type:application/download");
Header (' Content-disposition:inline;filename= '. $outfile. ' ');
Header ("Content-transfer-encoding:binary");
Header ("Cache-control:must-revalidate, Post-check=0, pre-check=0");
Header ("Pragma:no-cache");
$objWriter->save (' php://output ');
Exit
}
This is a small example of my programming, where mark, if you want to do a simple example, can be used directly, mainly on the row, column read.