If i want to write to an excisting xls file

Topics: Developer Forum, Project Management Forum, User Forum
Feb 14, 2013 at 11:43 AM
I have a template file of a invoce and i want to write to it and save it with a diffrent filename is that possible and how ?
Coordinator
Feb 14, 2013 at 11:51 AM
  1. Load your template into a PHPExcel object
  2. Update the PHPExcel object
  3. Instantiate a Writer
  4. Save the PHPExcel object using the Writer
There are plenty of examples in the Tests or Examples folders, plus documentation in the Documentation folder
Feb 14, 2013 at 11:54 AM
Thx

Can you write an example ? PLEASE
Coordinator
Feb 14, 2013 at 12:09 PM
Edited Feb 14, 2013 at 12:10 PM
We provide documentation and examples to help you with the basic functionality of PHPExcel.... it is worth reading
$objPHPExcel = PHPExcel_IOFactory::load("myTemplateFile.xlsx");
$objPHPExcel->getActiveSheet()
    ->setCellValue('A1', 'Hello World');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
$objWriter->save('mySavedFile.xlsx');