|
 |
|
อยากทราบ วิธีใช้ phpExcel เขียนทับไฟล์เดิม หรือเขียนลงในไฟล์ Template |
|
 |
|
|
 |
 |
|
ได้เลยครับ ปกติก็ใช้วิธ๊นี้แหละครับ Format เปะ ๆ เลยครับ
Code (PHPExcel Open Template)
<?
/** Error reporting */
error_reporting(E_ALL);
/** PHPExcel_IOFactory */
require_once 'Classes/PHPExcel/IOFactory.php';
$objReader = PHPExcel_IOFactory::createReader('Excel5');
$objPHPExcel = $objReader->load("templates/report_template.xls");
$objPHPExcel->getActiveSheet()->setCellValue('A1', ''.iconv('TIS-620','UTF-8'," รายงานข้อมูลการจัดซื้อ").'');
$objPHPExcel->getActiveSheet()->setCellValue('F2',"2000");
$strFileName = "REPORT-".date("YmdHis").".xls";
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save("excel/".$strFileName);
?>
|
 |
 |
 |
 |
Date :
2015-12-16 11:00:24 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|