我正在使用 PHPExcel_1.7.9 库以 .xlsx 格式导出数据。该库包含 223 个文件和 53 个文件夹。我想要只对我的功能有用的文件和文件夹(以避免在服务器上上传不必要的文件)。
贝娄是代码,工作得很好。
//----CODE TO EXPORT DATA DIRECTLY AS EXCEL(.XLSX) WITHOUT HELP OF CSV FORMAT ----------
require_once ROOT_PATH . '/Classes/PHPExcel.php';
$header=$exportPlugin->getCommonHeader($case,$frmDate,$toDate,$empid,$divId,$excpCode,$reportType,$varType);
$data=$exportPlugin->getCommonFilterData($case,$frmDate,$toDate,$empid,$divId,$excpCode,$reportType,$varType);
$base_path1 = dirname(__FILE__);
$lastSpacePosition1 = strrpos($base_path1,"\lib");
$base_path1 = substr($base_path1,0,$lastSpacePosition1);
$csvName=str_replace(':','',$csvName);
$pathh=$base_path1.'\fileexports\\'.$csvName.".xlsx";
//file_put_contents($pathh, $csvContents);
$objPHPExcel=new PHPExcel();
$objPHPExcel->setActiveSheetIndex(0);
$alpha=Array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
$objPHPExcel->getDefaultStyle()->getAlignment()->setHorizontal(PHPExcel_Style_Alignment::HORIZONTAL_CENTER);
for($i=0;$igetActiveSheet()->setCellValue($alpha[$i].'1' , $header[$i]);
}
$n=3;
for ($i = 0; $i getActiveSheet()->setCellValue($alpha[$j]. $n, $data[$i][$j]);
}
$n++;
}
foreach(range('A','Z') as $columnID) {
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
}
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel,'Excel2007');
$objWriter->save($pathh);
ob_end_clean();
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment; filename='. $pathh);
header('Cache-Control: max-age=0');
readfile($pathh);
unlink($pathh);
//-----------------------------------------------------------------------------------------
请告诉我 PHPExcel 库中有多少和哪些文件或文件夹,我应该保留在项目中,哪些可以删除???
工作环境
-.......服务器 - XAMPP
............Apache/2.2.11 (Win32) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2。 9
..........MySQL 客户端版本:5.0.51a
........PHP 扩展名:mysql
.......OS - WINDOWS7