PHPExcel sheet复制
2017-04-21 21:20
549 查看
1.百度千百篇,在bing搜索里找到答案
直接上内容
引用 http://www.guanggua.com/question/32712542-phpexcel-clone-sheet-and-keep-its-original-style.html,http://stackoverflow.com/questions/35242339/phpexcel-copy-sheet-from-one-to-another-xls-document-with-style
error_reporting(E_ALL);
ini_set(‘display_errors’, TRUE);
ini_set(‘display_startup_errors’, TRUE);
date_default_timezone_set(‘Europe/London’);
define(‘EOL’,(PHP_SAPI == ‘cli’) ? PHP_EOL : ‘
’);
/* Include PHPExcel /
require_once dirname(FILE) . ‘/phpexcel/Classes/PHPExcel.php’;
$savepath= dirname(FILE);
objPHPExcel=PHPExcelIOFactory::load(savepath.”/”.”x.xlsx”);
//重要
objPHPExcel1=PHPExcelIOFactory::load(savepath.”/”.”x.xlsx”);
k=0;foreach(objPHPExcel1->getSheetNames() as sheetName)
{k++;
sheet=objPHPExcel1->getSheetByName(sheetName);sheet->setTitle('Sheet'.k);objPHPExcel->addExternalSheet(sheet);unset(sheet);
}
header(‘Content-Type: application/vnd.ms-excel’);
header(‘Content-Disposition: attachment;filename=”01simple.xlsx”’);
header(‘Cache-Control: max-age=0’);
// If you’re serving to IE 9, then the following may be needed
header(‘Cache-Control: max-age=1’);
// If you’re serving to IE over SSL, then the following may be needed
header (‘Expires: Mon, 26 Jul 1997 05:00:00 GMT’); // Date in the past
header (‘Last-Modified: ‘.gmdate(‘D, d M Y H:i:s’).’ GMT’); // always modified
header (‘Cache-Control: cache, must-revalidate’); // HTTP/1.1
header (‘Pragma: public’); // HTTP/1.0
objWriter=PHPExcelIOFactory::createWriter(PHPExcel, ‘Excel2007’);
$objWriter->save(‘php://output’);
exit;
直接上内容
引用 http://www.guanggua.com/question/32712542-phpexcel-clone-sheet-and-keep-its-original-style.html,http://stackoverflow.com/questions/35242339/phpexcel-copy-sheet-from-one-to-another-xls-document-with-style
error_reporting(E_ALL);
ini_set(‘display_errors’, TRUE);
ini_set(‘display_startup_errors’, TRUE);
date_default_timezone_set(‘Europe/London’);
define(‘EOL’,(PHP_SAPI == ‘cli’) ? PHP_EOL : ‘
’);
/* Include PHPExcel /
require_once dirname(FILE) . ‘/phpexcel/Classes/PHPExcel.php’;
$savepath= dirname(FILE);
objPHPExcel=PHPExcelIOFactory::load(savepath.”/”.”x.xlsx”);
//重要
objPHPExcel1=PHPExcelIOFactory::load(savepath.”/”.”x.xlsx”);
k=0;foreach(objPHPExcel1->getSheetNames() as sheetName)
{k++;
sheet=objPHPExcel1->getSheetByName(sheetName);sheet->setTitle('Sheet'.k);objPHPExcel->addExternalSheet(sheet);unset(sheet);
}
header(‘Content-Type: application/vnd.ms-excel’);
header(‘Content-Disposition: attachment;filename=”01simple.xlsx”’);
header(‘Cache-Control: max-age=0’);
// If you’re serving to IE 9, then the following may be needed
header(‘Cache-Control: max-age=1’);
// If you’re serving to IE over SSL, then the following may be needed
header (‘Expires: Mon, 26 Jul 1997 05:00:00 GMT’); // Date in the past
header (‘Last-Modified: ‘.gmdate(‘D, d M Y H:i:s’).’ GMT’); // always modified
header (‘Cache-Control: cache, must-revalidate’); // HTTP/1.1
header (‘Pragma: public’); // HTTP/1.0
objWriter=PHPExcelIOFactory::createWriter(PHPExcel, ‘Excel2007’);
$objWriter->save(‘php://output’);
exit;
相关文章推荐
- PHP读取Excel 之 Spreadsheet_Excel_Reader
- Excel中Sheet复制
- excel sheet的 某列(m*n行) 快速复制到 m行n列区域
- PHPExcel 修改已经存在的excel文档中某个sheet中的内容
- 如何正确运用PHP Spreadsheet_Excel_Writer
- PHP导出Excel 之 Spreadsheet_Excel_Writer
- PHP导出Excel 之 Spreadsheet_Excel_Writer
- excel sheet中数据的快速复制
- java poi 复制excel中的sheet
- Create a Multi-Sheet Excel Workbooks By PHPExcel || PHPExcel 多sheet的excel
- PHP Excel类Spreadsheet_Excel_Writer简介
- C# 操作Excel ---复制Excel的sheet
- 基于Spreadsheet的php生成excel
- excel sheet的 某列(m*n行) 快速复制到 m行n列区域
- C#处理多个Excel合并,复制Sheet
- PHP读取Excel 之 Spreadsheet_Excel_Reader
- PHP Excel类Spreadsheet_Excel_Writer 导出UTF8中文乱码的解决方法。
- PHP导出Excel 之 Spreadsheet_Excel_Writer
- excel sheet中数据的快速复制
- php 5.4 使用 Spreadsheet_Excel_Writer 导出excel