|
Posted by Paul on 06/07/07 23:33
I use OpenOffice but I suppose similar formatting rules apply to MS Excel.
For example, to format a cell for two digit numbering, the format code is:
#,##0.00
I can use formulas (=F$temp + 5) and there's likely a way to write
formatting strings in the output code, I just need a little help. Any
ideas?
My code is fairly typical to export to spreadsheet:
//get data from database
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"my-data.xls\"");
$data = "";
$temp = 0;
foreach($r as $row) {
$temp++;
$data .= $row['data1'].",".$row['some_number'].",=F$temp + 5\r\n";
};
echo $data;
[Back to original message]
|