[thelist] sending an asp header to export xls in xhtml
brian cummiskey
brian at hondaswap.com
Wed May 5 11:47:48 CDT 2004
Hi all, long time no post. :)
I'm working on an intrnet application in asp which exports results in an
xls excel spreadsheet, viewable within internet explorer.
Before I added an xhtml trans doc type, the open-save dialog box would
come up and be a 'celled' worksheet, styled as i wished. Now, with the
dtd, its loosing all my formatting from my style sheet.
If I hard code a <font> tag in the query loop, it will style, but a <td
class="foo"> will not.
Any ideas?
here's the code:
-----------------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xml:lang="en" lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Dialer Reports</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" media="screen"
href="../style2.css" />
<!-- #include file="resources/includes/dbStuff.inc" -->
</head>
<%
Response.ContentType = "application/vnd.ms-excel"
%>
<body>
<div id="header">
<h1>LBI // Dialer Reports</h1>
<h3>EET4171</h3>
</div>
<div id="menu">
<a href="../default.asp">Return to Main
Menu</a> | <a href="EET4171.asp">Return to Job
Menu</a>
</div>
<div id="results">
<form name="results" method="post" action="EET4171.asp">
<%
dim rst, comm
server.ScriptTimeout = 3600
set comm = Server.CreateObject ("ADODB.Command")
set rst = Server.CreateObject("ADODB.Recordset")
comm.CommandTimeout = 0
comm.ActiveConnection = connstr
comm.CommandText = "sp_MULTI_no_other_417x"
comm.CommandType = adCmdStoredProc
comm.Parameters("@jobID") = "EET4171"
set rst = comm.Execute
set comm = Nothing
' Build the table -->
if not rst.EOF then
%>
<table width="90%" border="1" align=center cellpadding=5>
<%
for x = 0 to rst.Fields.count - 1
'if not isnull(rst.Fields(x).Value) then
if instr(1, rst.Fields(x).Name, "SP_") > 0 then
' Skip SP_SH and SP
else
Response.Write "<th>" & trim(rst.Fields(x).Name) &
"</th>" & vbcrlf
end if
'end if
next
do until rst.eof
if lineForm = 0 then
Response.Write "<tr>" & vbcrlf
lineForm = 1
else
Response.Write "<tr>" & vbcrlf
lineForm = 0
end if
for x = 0 to rst.Fields.count - 1
if not isnull(rst.Fields(x).Value) then
if instr(1, rst.Fields(x).Name, "SP_") > 0 then
' Skip SP_SH and SP
else
Response.Write "<td>" & trim(rst.Fields(x).Value) &
"</td>" & vbcrlf
end if
else
Response.Write "<td> </td>"
end if
next
Response.Write "</tr>" & vbcrlf
rst.MoveNext
loop
%>
</table>
<%
else
%>
<h3>No entries where found based on your search criteria.</h3>
<%
end if
%>
<div class="center"><input type='button' Value='Back'
onclick='history.go(-1)'></div>
</div>
</body>
</html>
More information about the thelist
mailing list