getactivesheet()->setcellvalue('a1','key'); $obj_phpexcel->getactivesheet()->setcellvalue('b1','value'); if($data){ $i =2; foreach ($data as $key => $value) { # code... $obj_phpexcel->getactivesheet()->setcellvalue('a'.$i,$value); $i++; } } $obj_writer = phpexcel_iofactory::createwriter($obj_phpexcel,'excel5'); $filename = outexcel.xls; header(content-type: application/force-download); header(content-type: application/octet-stream); header(content-type: application/download); header('content-disposition:inline;filename='.$filename.''); header(content-transfer-encoding: binary); header(last-modified: . gmdate(d, d m y h:i:s) . gmt); header(cache-control: must-revalidate, post-check=0, pre-check=0); header(pragma: no-cache); $obj_writer->save('php://output'); } //at 2013-8-24 11:22:18
