PHPExcel 转HTML
2021-02-07 09:17
标签:jre pat ide sheet php ade 文件名 obj exce PHPExcel 转HTML 标签:jre pat ide sheet php ade 文件名 obj exce 原文地址:https://www.cnblogs.com/liuxd/p/13093810.html$filePath = ‘./123.xls‘;
$fileType = \PHPExcel_IOFactory::identify($filePath); //文件名自动判断文件类型
$objReader = \PHPExcel_IOFactory::createReader($fileType);
$objPHPExcel = $objReader->load($filePath);
$savePath = ‘./123.html‘; //这里记得将文件名包含进去
$objWriter = new \PHPExcel_Writer_HTML($objPHPExcel);
//获取sheet总数
$objPHPExcel = $objReader->load($filePath);
$sheetIndex = $objPHPExcel->getSheetCount();
//echo $sheetIndex;exit;
$objWriter->setSheetIndex(0); //可以将括号中的0换成需要操作的sheet索引
$objWriter->save($savePath); //保存为html文件