Invoking Excel on Client browser

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
griffinmt
Forum Commoner
Posts: 35
Joined: Sun Jul 16, 2006 8:37 pm
Location: Michigan

Invoking Excel on Client browser

Post by griffinmt »

I have fields in a mysql database that contain the contents of excel spreadsheets that were originally saved in html format. Excel can load them, make changes and resave them without problems while they are kept as files.
What I 'want' to do is the following:

1) via php and mysql on the server side, extract the full html structured data of the sheet.
2) send it to the client (inside an iframe) in a way that will launch excel with that data embedded in the iframe.
3) have them make whatever changes needed to the data and when ready save it back into the database in its html format.

I have done this using a dedicated application (VB) and using the Microsoft Web Components that come with Office, but now I am migrating the app to run under a browser (and with several users).

Open to any suggestions on how/where to get started with this portion of the conversion!

Oops, should have mentioned:
all client browsers will be IE 6 or higher
all clients will be windows with office 2003 installed.
server is linux with php v5 and mysql v5 and apache 2.2.2

TIA
Martyn
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Invoking Excel on Client browser

Post by Christopher »

Just set the MIME type for Excel using the header() function and then send the file to the browser. It should open it with whatever is the registered application for that MIME type (OpenOffice Calc in my case ;)).
(#10850)
griffinmt
Forum Commoner
Posts: 35
Joined: Sun Jul 16, 2006 8:37 pm
Location: Michigan

Re: Invoking Excel on Client browser

Post by griffinmt »

I have already done this. On the surface, it would seem that because the data is in an html structure, it is not being sent to excel. I set the header to application/vnd.ms-exec then tried application/ms-excel then tried application/excel, all with the result of just displaying a native html view of the information.

I know it 'should' work because when I point the browser directly at the original .xls file it loads up excel in the window. Also, if I take the save html format of that file, rename it with an xls extension and repeat the exercise, it causes the excel mime type to take action and loads up excel too. But apparently not the ones I have tried!!!
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Invoking Excel on Client browser

Post by Christopher »

Have you set other headers, like the composition so the file name ends with .xls? OSs use both extension and MIME type to identify files.
(#10850)
Post Reply