I use PHPExcel to describe a template from Excel with php and then output it.
Problem is that I want to save the file on the desktop but I don't know how to define the path to the desktop?
I would also like to integrate "header" into the file so that the save dialog appears. But this doesn't work if I load a template because I get the error message: "File type doesn't fit".
Here is my existing code:
// Start
define('EOL',(PHP_SAPI == 'cli') ? PHP_EOL : '<br />');
// Include Class
require_once dirname(__FILE__) . '/Classes/PHPExcel.php';
// Template loading
$objPHPExcel = PHPExcel_IOFactory::load('Template.xlsx');
// Define Values
$test = 'Test';
$objPHPExcel->setActiveSheetIndex(0)
->setCellValue('B5', $test)
;
// Excel Document save
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('C:\Users\ ??? \Desktop\Data.xlsx');
Thanks for help