ASP Dynamic Excel Creation

C

Chris Oswald

When I dynamically generate my Excel file it prompts me
twice to open it. Any ideas why?

Office 2003
Windows XP
IE 6

Response.ContentType = "application/vnd.ms-excel"
Response.AddHeader "Content-
Disposition", "attachment;filename=OSRHistory" &
strVersion & ".xls"

%>
<table border="1">
<tr>
<%
For Each objField In objRS.Fields
%>
<th style="background-
color:gray;color:white"><%=objField.Name%></th>
<%
Next
%>

</tr>

<%
While Not objRS.EOF
%>
<tr>
<%
For Each objField In
objRS.Fields

If (UCASE(objField.Name) = "STATION") Then

%>
<td align="Center"><%="&nbsp;" & CStr
(objField.Value)%></td>
<%
Else
%>
<td><%=objField.Value%></td>
<%
End If
Next
%>
</tr>
<%
objRS.MoveNext

WEnd
%>
</table>
<%
 

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

Top