J
Jim, N2VX
I'd like to create/display an Excel spreadsheet from javascript. We
have an HTML page with results of a search and it can be reasonably
large.
The first attempt was to format the data into an HTML table and send
it to an ASP page. The ASP page has:
Response.AddHeader ("Content-Disposition", "inline");
Response.ContentType = "application/vnd.ms-excel");
Response.Write(formatted_html_data);
Works fine until there's more than 100K bytes of data. It then hits
an ASP limit and blows chunks.
Second attempt: Do it all on the client side in Javascript. A
variable has the HTML:
<html>
<head>
<meta http-equiv="Content-Type" CONTENT="application/vnd.ms-excel">
<meta http-equiv="Content-Disposition" CONTENT="inline">
</head>
<body>
<table>
....html-formatted data...
</table></body></html>
We send the data to a new window:
var newWin = window.open('','','width=300,height=300');
newWin.document.write(variable_with_html);
newWin.document.close()
The window pops up, html-formatted data displays in it, but Excel
doesn't run.
What's the difference between the first method and the second? Both
send 'stuff' to the browser that it will interpret.
Are the <meta> tags wrong? It's the only thing I can think of, since
one is generated by ASP (and it works) and the other by me (doesn't
work).
Thanks,
Jim
have an HTML page with results of a search and it can be reasonably
large.
The first attempt was to format the data into an HTML table and send
it to an ASP page. The ASP page has:
Response.AddHeader ("Content-Disposition", "inline");
Response.ContentType = "application/vnd.ms-excel");
Response.Write(formatted_html_data);
Works fine until there's more than 100K bytes of data. It then hits
an ASP limit and blows chunks.
Second attempt: Do it all on the client side in Javascript. A
variable has the HTML:
<html>
<head>
<meta http-equiv="Content-Type" CONTENT="application/vnd.ms-excel">
<meta http-equiv="Content-Disposition" CONTENT="inline">
</head>
<body>
<table>
....html-formatted data...
</table></body></html>
We send the data to a new window:
var newWin = window.open('','','width=300,height=300');
newWin.document.write(variable_with_html);
newWin.document.close()
The window pops up, html-formatted data displays in it, but Excel
doesn't run.
What's the difference between the first method and the second? Both
send 'stuff' to the browser that it will interpret.
Are the <meta> tags wrong? It's the only thing I can think of, since
one is generated by ASP (and it works) and the other by me (doesn't
work).
Thanks,
Jim