Re: Revised [PHP] COM and PHP
| From: | Daniel Tryba | Date: | Wed, 28 Feb 2001 10:35:15 +0000 |
| Subject: | Re: Revised [PHP] COM and PHP | ||
| References: | 1 | Groups: | php.general php.windows |
| Request: | Send a blank email to php-general+get-41986@lists.php.net to get a copy of this message | ||
On Mon, Feb 05, 2001 at 03:05:24PM -0500, Conover, Ryan wrote:
> I have been trying the following example from the PHP developer's cookbook
> and it keeps giving me the following error.
>
> Parse error: parse error in c:\Inetpub\wwwroot/temp.php on line 5
> <? //line 1
> $excel_handle = new COM("excel.application"); //line2
> $excel_handle->Visible = false; //line3
> $worksheet = $excel_handle->workbooks->add(); //line4
> $worksheet->Cells(1,1)->value = "Name"; //line5
> $worksheet->SaveAs("temp.xls"); //line6
> $excel_handle->quit(); //line7
> //line8
> ?> //line9
>
> Anyone that has Com and PHP experience help please
I didn't test it in PHP (only in wscript.exe), but it seems the example
is wrong. It should be (line 4 -> 4a, 4b):
excel_handle = new COM("Excel.Application"); //line2
excel_handle.Visible = true; //line3
workbook = excel_handle.Workbooks.Add(); //4a
worksheet=workbook.WorkSheets.Add(); //4b
worksheet.Cells(1,1).Value = "Name"; //line5
worksheet.SaveAs("temp.xls"); //line6
excel_handle.quit(); //line7
This seems to work.