标签:cat get blank cti 数据 xls creates tst save
参考链接:
https://blog.csdn.net/qq_21386275/article/details/68946721
流程大致如下:
新建phpExcel对象:
$phpExcel = new PHPExcel()对象
创建表 :
$zeroSheet = $phpExcel->createSheet(0)
设置表头信息
$zeroSheet->setTitle(‘缺陷原数据‘); $zeroSheet->setCellValue(‘A1‘, ‘问题类型‘); //设置列名
填充表内数据
$i=2; foreach ( $data as $row){ $zeroSheet -> setCellValue(‘A‘.$i, $row[‘id‘]); $zeroSheet -> getStyle(‘A‘.$i) -> getFont()-> setBold(true); $i++; }
设置Excel属性
$phpExcel -> setActiveSheetIndex(0); //设置默认激活页 $outputFileName = "缺陷源数据.xls"; $xlsWriter = new PHPExcel_Writer_Excel5($phpExcel); header(‘content-Type: application/Force-download‘); header(‘Content-Disposition: attachment;filename="‘ . $outputFileName . ‘.xlsx"‘); $xlsWriter->save("php://output"); //保存在服务器上
标签:cat get blank cti 数据 xls creates tst save
原文地址:https://www.cnblogs.com/hiluna/p/9295631.html