Set properties

Nov 10, 2010 at 6:24 AM
Edited Nov 10, 2010 at 6:32 AM

Don't work setting properties.  Do you have any solution?

Example:

<?php
error_reporting(E_ALL);
date_default_timezone_set('Europe/London');
require_once '../Classes/PHPExcel.php';

// Create new PHPExcel object
$objPHPExcel = new PHPExcel();

// Set properties
$objPHPExcel->getProperties()->setCreator("Maarten Balliauw")
                             ->setLastModifiedBy("Maarten Balliauw")
                             ->setTitle("Office 2005 XLS Test Document")
                             ->setSubject("Office 2005 XLS Test Document")
                             ->setDescription("Test document for Office 2005 XLS, generated using PHP classes.")
                             ->setKeywords("office 2005 openxml php")
                             ->setCategory("Test result file");

// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);

// Redirect output to a client’s web browser (Excel5)
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment;filename="test.xls"');
header('Cache-Control: max-age=0');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
$objWriter->save('php://output');
exit;

?>

Coordinator
Nov 10, 2010 at 12:38 PM

Writing Document Properties is not currently supported in the Excel5 Writer - Work Item 9759. This requires a change to the underlying OLE Writer to support the property streams

Feb 14, 2011 at 9:17 AM
Edited Feb 14, 2011 at 10:14 AM

Update: I hadn't noticed the Functionality Cross-Reference.xls document. My excuses, it's hard to grasp a full new library.

 

It'd be nice if stuff like this was documented somewhere and removed / commented out from the examples. It's frustrating to spend an hour trying to make a feature work just to find out it's not supposed to work.

Maybe something like this:

method setCreator [line 158]

PHPExcel_DocumentProperties setCreator( [string $pValue = ''])

Set Creator

Tags:

access:   public
formats:  Excel5 (reader), Excel2007 (reader and writer)

Parameters:

string   $pValue  

[ Top ]