Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PHP and COM question

Status
Not open for further replies.

pyth0n

Programmer
Jan 26, 2005
23
GB
This is a bit of a newbie question really. I am trying to use COM to write an Excel spreadsheet from an MSSQL database - limited here by my employers choice of technology.

What I want to do is set up a web script that will gather data from the user: dates, preferences etc, then query the database and write the output to Excel. The first two (webform and db query) I can do with my eyes shut, but I have never had to script into Excel before.

Is there a way of doing this without in PHP having to script a VBScript page to do the Excel work.

In essence, what I am asking is: Is it possible to use a webscript to execute a CLI script, or can I get the browser (IE6) to open Excel as a COM client, like I can with VB.

The network is XP based, with MSSQL2000 on MSWin2003Server.

Any pointers will be greatly received.

Thanks
 
does the output have to be IN excel or can it just be readable natively by Excel?

i ask because an html formatted table will open up just fine in excel and if you save the output noone will know it was not written natively.

but you can't create things like functions in this way.

the specific answer to your question is that php does support COM (check the manual), and you can make it all work if you really must. have a look also at the pear::spreadsheet class.
 
Thanks, it does need to be in native Excel format, but I will look at the PEAR extension.

I know that PHP supports COM, but nowhere in the manual does it state if it will run under CGI, it also doesn't state that it runs under CLI, but I know it does because I can do this. What I can't do is get the CGI script to open and write to Excel, nor can I get the CGI script to exec() an external script.

To further clarify, PHP5 is running on a Window box under apache2.

I am wondering it is something to do with the configuration, but that is a different question.
 
should work under as a cgi or sapi. one thing to consider with sapi/cgi is the permissions that the web server is running under. of course as a cli the script is run under the actual user's logon credentials.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top