| 
	
 | 
 Posted by Sonnich on 01/16/07 10:47 
ABC wrote: 
> Hi, 
> Can i write to MS-Excel using PHP? I am using PHP 5 on Linux. Any help 
> would be appreciated! 
> 
> Thanks, 
> Raghu 
 
That depends - you can write a file, which Excel can read, and add a 
link to that. AFAIK only ASP has an option to open a file in Excel. 
Correct me if I am wrong. 
 
Af for exporting there are a few tricks: 
 
        $ff3=fopen($targetdir."\\some_file.xls", "w"); 
        fwrite($ff3, "<html><table border=1>\r\n"); 
        fwrite($ff3, "<tr><td><b>Item:</b></td> <td><b>Used 
in:</b></td> <tr>\r\n"); 
        fwrite($ff3, "<tr><td>sugar</td><td>coffee</td></tr>"); 
 
For tricks with numbers, try: 
   <STYLE TYPE="text/css"><!-- 
    .number2dec {mso-number-format: Fixed;} 
   --></STYLE> 
and use it like 
<td class=""number2dec"">" . $price ."</td><td class=""number2dec""> 
=d" . $y1 . "*e" . $y2 ."</td>" 
This will add the first as a number, and the seconds as a fomula. 
 
Try play around with this. 
 
S
 
[Back to original message] 
 |