Home > Article > Backend Development > PHPExcel的保存文件问题
<?phperror_reporting(E_ALL);set_include_path(get_include_path().PATH_SEPARATOR."./php/Classes/");require_once("PHPExcel.php");require_once("PHPExcel/IOFactory.php");$objPHPExcel = new PHPExcel();$objPHPExcel->getProperties()->setCreator("Maarten Balliauw");$objPHPExcel->getProperties()->setLastModifiedBy("Maarten Balliauw");$objPHPExcel->getProperties()->setTitle("Office 2007 XLSX Test Document");$objPHPExcel->getProperties()->setSubject("Office 2007 XLSX Test Document");$objPHPExcel->getProperties()->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.");$objPHPExcel->getProperties()->setKeywords("office 2007 openxml php");$objPHPExcel->getProperties()->setCategory("Test result file");$objPHPExcel->setActiveSheetIndex(0);$objPHPExcel->getActiveSheet()->setCellValue('A1', 'Hello1');$objPHPExcel->getActiveSheet()->setCellValue('B1', 'world2');$objPHPExcel->getActiveSheet()->setCellValue('C1', 'Hello3');$objPHPExcel->getActiveSheet()->setCellValue('D1', 'world4');$objPHPExcel->getActiveSheet()->setTitle('sheet01');$objPHPExcel->setActiveSheetIndex(0);$phpexcel = PHPExcel_IOFactory::load("phonelist.xls");$sheet = clone $phpexcel->getActiveSheet();$objPHPExcel->addExternalSheet($sheet);$objPHPExcel->removeSheetByIndex(0);$objPHPExcel->getActiveSheet()->removeRow(3);$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');$objWriter->save(str_replace('.php', '.xlsx', __FILE__));// __FILE__ => excel文件的绝对路径?>
为什么要用 form包住代码?
把放到php代码前面看看。
为什么要用 form包住代码?
把放到php代码前面看看。