Spreadsheet_Excel_Writer & PHP 5
Posted: Tue Jan 06, 2009 5:55 pm
I tried using PEAR's Spreadsheet_Excel_Writer to generate Excel XLS file. Initial results were good until I turned on E_STRICT and up came the flashing lights. (see below) . I am using PHP 5.2. Am I going something wrong? Can I trust that this code will continue to work in future releases? Has this package been updated/replaced?
Code: Select all
<?php
error_reporting(E_ALL | E_WARNING | E_STRICT );
ini_set('display_errors', TRUE);
@unlink('binary.xls');
// Include PEAR::Spreadsheet_Excel_Writer
require_once "Spreadsheet/Excel/Writer.php";
// Create an instance, passing the filename to create
$xls =& new Spreadsheet_Excel_Writer('binary.xls');
// Add a worksheet to the file, returning an object to add data to
$sheet =& $xls->addWorksheet('Binary Count');
$csvLine = array("Ticket Number",
"Sys.Serv",
"Period",
"WO Rcv'd",
"Message",);
$excelColCount=0;
foreach ($csvLine as $item)
{
$sheet->write(0,$excelColCount++,$item);
}
// Write some numbers
for ( $i=0;$i<11;$i++ ) {
// Use PHP's decbin() function to convert integer to binary
$sheet->write($i,0,decbin($i));
}
// Finish the spreadsheet
$xls->close();
?>Code: Select all
Strict Standards: Assigning the return value of new by reference is deprecated in C:\xampp\php\pear\PEAR.php on line 569
Strict Standards: Assigning the return value of new by reference is deprecated in C:\xampp\php\pear\PEAR.php on line 572
Strict Standards: Assigning the return value of new by reference is deprecated in C:\xampp\php\pear\Spreadsheet\Excel\Writer\Workbook.php on line 186
Strict Standards: Assigning the return value of new by reference is deprecated in C:\xampp\php\pear\Spreadsheet\Excel\Writer\Workbook.php on line 195
Strict Standards: Non-static method OLE::Asc2Ucs() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\Spreadsheet\Excel\Writer\Workbook.php on line 586
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in C:\xampp\php\pear\PEAR.php on line 281
Strict Standards: Non-static method OLE::Asc2Ucs() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\OLE\PPS\Root.php on line 52
Strict Standards: Non-static method OLE::LocalDate2OLE() should not be called statically, assuming $this from incompatible context in C:\xampp\php\pear\OLE\PPS.php on line 186