Hi All,
I am trying to create a spreadsheet though PHP. Tough i am not using any specific library, i am formatting the data first and then writing it into file as text stream. The excel file is getting generated but the data is populating only once cell (left first row), but i want it to be in different rows and columns (db extraction). I tried a simple code to check but the output is still in single cell. Following is the code.
The output file contains TESTINGTESTING2 in first left hand cell but i want it to be on different cells. Can anyone guide me here for what is wrong.
Thanks in advance.
I am trying to create a spreadsheet though PHP. Tough i am not using any specific library, i am formatting the data first and then writing it into file as text stream. The excel file is getting generated but the data is populating only once cell (left first row), but i want it to be in different rows and columns (db extraction). I tried a simple code to check but the output is still in single cell. Following is the code.
Code:
<?php
$file = "report_" . date('Ymd') . ".xls";
$content = ' <Worksheet ss:Name="report">' . "\n";
$content .= ' <Table>' . "\n";
$content .= '<ss:Row>'."\n";
$content .= '<Cell>';
$content .= '<Data ss:Type="TEXT">TESTING</Data>';
$content .= '</Cell>';
$content .= '<Cell>';
$content .= '<Data ss:Type="TEXT">TESTING2</Data>';
$content .= '</Cell>';
$content .= '</ss:Row>'. "\n";
$content .= ' </Table>' . "\n";
$content .= ' </Worksheet>' . "\n";
$fd = fopen("f:\\test\\$file",'w+') or die ("can not open the file!!");
fwrite($fd,$content);
fclose($fd);
?>
The output file contains TESTINGTESTING2 in first left hand cell but i want it to be on different cells. Can anyone guide me here for what is wrong.
Thanks in advance.