Need help with code to download table to excel

L

lxrocks

Hi
I have always downloaded table data to excel using a perl_cgi. The perl
cgi will simpley print("Content-Type: application/vnd.ms-excel");
followed by the usual html table formatted data.

However if I try the same with javascript it does not seem to work.

ie document.write("Content-Type: application/vnd.ms-excel");
document.write("<html><table><thead>bla bla...</html>);


This never triggers the save file as/ or open with excel. It displays
the data in the browser but does not trigger an excel save.


What am I doing wrong?

Thanks
 
A

ASM

lxrocks a écrit :
Hi
I have always downloaded table data to excel using a perl_cgi. The perl
cgi will simpley print("Content-Type: application/vnd.ms-excel");
followed by the usual html table formatted data.

where does-it print that ?
However if I try the same with javascript it does not seem to work.

where do you try the following ?
ie document.write("Content-Type: application/vnd.ms-excel");
document.write("<html><table><thead>bla bla...</html>);

That would have to write an "html" file ( *.html )
This never triggers the save file as/ or open with excel. It displays
the data in the browser but does not trigger an excel save.


What am I doing wrong?

To do not produce an Excel file ( *.xls ) ?

My last play with this idea (Excel document) :
http://perso.orange.fr/stephane.moriaux/truc/html_to_xls_op.shtml

Perhaps with XML and JS-DOM ?

And read or re-read here in c.l.javascript the thread :
"FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?"
<http://groups.google.com/group/comp...0349b96de6/75c7b581bb814f10?#75c7b581bb814f10>
 
L

lxrocks

ASM said:
lxrocks a écrit :

where does-it print that ?


where do you try the following ?


That would have to write an "html" file ( *.html )


To do not produce an Excel file ( *.xls ) ?

My last play with this idea (Excel document) :
http://perso.orange.fr/stephane.moriaux/truc/html_to_xls_op.shtml

Perhaps with XML and JS-DOM ?

And read or re-read here in c.l.javascript the thread :
"FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?"
<http://groups.google.com/group/comp...0349b96de6/75c7b581bb814f10?#75c7b581bb814f10>
I realise now that there is a difference between client and server side
code when dealing with Mime. Thank you for the example it is most helpful.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top