The code is as follows |
| < td="">
| $dir = $DOCUMENT _root. ' /backoffice/admin/oemcheck/'; $templateName = ' 1.xlsx ';$outputFileName = ' template. xlsx ';$txt = ' Test '; Instantiating an Excel Read class$PHPReader = new phpexcel_reader_excel2007 ();if (! $PHPReader->canread ($dir. $templateName)) {$PHPReader = new Phpexcel_reader_excel5 ();if (! $PHPReader->canread ($dir. $templateName)) {echo ' Unrecognized Excel file! ';return false;}}Read Excel$PHPExcel = $PHPReader->load ($dir. $templateName);Reading sheet 1$currentSheet = $PHPExcel->getsheet (0); $currentSheet->setcellvalue (' B13 ', iconv (' GBK ', ' utf-8 ', $txt));//table header assignment//Instantiate Excel Write Class Www.111cn.net$PHPWriter = new phpexcel_writer_excel2007 ($PHPExcel);Ob_start ();Header ("Content-type:application/force-download");Header ("Content-type:application/octet-stream");Header ("Content-type:application/download");Header (' Content-disposition:attachment;filename= '. $outputFileName. ' "');//Output template nameHeader ("Content-transfer-encoding:binary");Header ("last-modified:". Gmdate ("D, D M Y h:i:s"). " GMT ");Header (' Pragma:public ');Header (' expires:30 ');Header (' Cache-control:public ');$PHPWriter->save (' php://output ');
From: http://www.111cn.net/phper/php/58174.htm articles you may be interested in
- Phpexcel Generating Excel Code
- PHP uses Phpexcel to generate Excel document instances
- Phpexcel class exporting data from MySQL to XLS garbled
- Phpexcel reading the Excel document code
- Using Phpexcel to read Excel implementation code
- Phpexcel read-Write XLS file implementation program
- Phpexcel Error resolution when exporting Excel files
- A detailed introduction to Phpexcel usage
- Phpexcel Data Memory Overflow solution
- The usage and introduction of Phpexcel
http://www.bkjia.com/PHPjc/738531.html www.bkjia.com true http://www.bkjia.com/PHPjc/738531.html techarticle The code is as follows $dir = $DOCUMENT _root. ' /backoffice/admin/oemcheck/'; $templateName = ' 1.xlsx '; $outputFileName = ' template. xlsx '; $txt = ' Test '; Instantiate Excel Read class $PHPReader = new ...