Forum Moderators: open

Message Too Old, No Replies

outputting excel to a browser

how?

         

natty

12:04 pm on Jul 12, 2004 (gmt 0)

10+ Year Member



hi all,

i can never find anything on msdn.
could someone explain if this is possible, and how easy/hard it may be..
i presume outputting a csv and setting the app type to excell or something?

tia

nat

IanTurner

2:09 pm on Jul 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Output as an HTML table with the content type set to application/vnd.ms-excel

natty

2:26 pm on Jul 12, 2004 (gmt 0)

10+ Year Member



cant say that that did the trick..
i tried this


<%@language="vbscript" codepage="1252"%>
<html>
<head>
<title>Claim List</title>
<meta http-equiv="Content-Type" content="application/vnd.ms-excel" />
</head>
<body>
<table border="1">
<%
for y = 1 to 50
response.write "<tr>"
for x = 1 to 6
response.write "<td>blah blah blah</td>"& vbcrlf
next
response.write "</tr>"
next
%>
</table>
</body>
</html>

obviously im doing somethign wrong..?!?
any further advice would be much appreciated.

tia

natty

2:58 pm on Jul 12, 2004 (gmt 0)

10+ Year Member



tyvm

aha. it all shows in the browser just fine, unfortunately excell actually pops up behind aswell, so im stuck with two windows, one the browser, showing the excell page, the other is excel open with nothing in it. can i get rid of that.?

tia

natty

3:52 pm on Jul 12, 2004 (gmt 0)

10+ Year Member



hi again all,

at the moment our system has most of the reports on the web, however we now need (some of) them to be out put in excel form.
is it possible to, from the existing reports simply pass through the table (html table) data through to an asp page, ready to show the same stuff in excel form?
this would save me rewriting all of the reports to come out in excel..

i can mbe see two ways for this, but neither seem any good...
parse my way through the current page, writing the table HTML to a temp file, then reading it back in via the page that outputs the Excel.
alternatively, pass the table html through via the request.form ..

any other ideas.?

IanTurner

5:04 pm on Jul 12, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



We use the same .asp page to display both the normal HTML page and the Excell Page.

It uses a querystring xl=1 to select the excel report.

The puts the content-type selection in an if statement:

if xl = 1 then
response.content-type = application/vnd.ms-excel
end if

(Syntax may not be correct as I'm typing it from memory)

Any parts of the page you don't want to include in the excel file put in an ASP if xl <> 1 then end if block.

natty

2:50 pm on Jul 13, 2004 (gmt 0)

10+ Year Member



hi again,

im still having slight problems with this.
ended up passing the table data through to a popup page, (frames so didnt want it to be in one). problem is there seems to be an erroneous 0 sat at the top of the page, where has this come from? and how do i get rid of it.

and still i am getting an excel window popping up along with the window i want.

obviously styles wont work , but i can still use <b> and <i> etc?

tia

IanTurner

3:37 pm on Jul 13, 2004 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



I haven't done anything fancy, just layout, numbers and formulas. I know that background colour works.

Can't say where your erroneous zero is coming from, that isn't something we have encountered and also I haven't seen the Excel window open in the background.