The code in the question has an error that causes the error.
This line writes a bunch of column names to row 0
$sheet->writeRow(0, 0, $colNames, $colHeadingFormat);
Then we have a loop that should write out rows of values.
for($i=1; $i<=10; $i++)
{
$row = array( "foo $i", "bar $i");
$sheet->writeRow($rowNumber++, 0, $row);
}
, $rowNumber , 0 .
, , Excel Writer.
, Excel, , , .
, Google Groups. . Micah, .
<?php
include("Spreadsheet/Excel/Writer.php");
$xls = new Spreadsheet_Excel_Writer();
$rowNumber = 0;
$sheet = $xls->addWorksheet('At a Glance');
$colNames = array('Foo', 'Bar');
$sheet->writeRow($rowNumber, 0, $colNames, $colHeadingFormat);
for($i=1; $i<=10; $i++)
{
$rowNumber++;
$row = array( "foo $i", "bar $i");
$sheet->writeRow($rowNumber, 0, $row);
}
header ("Expires: " . gmdate("D,d M Y H:i:s") . " GMT");
header ("Last-Modified: " . gmdate("D,d M Y H:i:s") . " GMT");
header ("Cache-Control: no-cache, must-revalidate");
header ("Pragma: no-cache");
$xls->send("test.xls");
$xls->close();
?>