I'm working on a classic ASP page that will invoke the Excel plugin when
using IE. Here's how I start it.
Response.ContentType = "application/vnd.ms-excel"
Response.Charset = ""
Response.CacheControl = "no-cache"
Response.AddHeader "Pragma", "no-cache"
Response.Expires = -1
After that I do a bunch of code to get data from a database.Then I just
construct an HTML table and use a style block for formating as in
<style>
table,td{border-style:solid;border-color:#C0C0C0;border-width:thin}
.title{font-weight:bold}
.label{font-weight:bold;padding-left:1em;vertical-align:middle}
.colhead{font-weight:bold;text-align:center;vertical-align:middle}
.participants{vertical-align:middle;padding-left:1em;height:24}
.badge{vertical-align:middle;text-align:right}
.total{font-weight:bold;vertical-align:middle;padding-left:6em;height:24}
</style>
Here's a snippet of the html coding
<tr>
<td class="label">Course Name:</td>
<td colspan=2 class="title"><%=strClassName%></td></tr>
<tr>
<td class="label">Dates:</td>
<td colspan=2>
<%=datStartDate%> to <%=datEndDate%><br></td></tr>
this is all working fine.
my problem is how to force a page break.
--
no place like 127.0.0.1
"st****@gmail.com" wrote:
I'm trying to export a datalist to Excel with this code:
Response.Clear()
Response.Buffer = True
Response.Charset = ""
Response.ContentType = "application/vnd.ms-excel"
Me.EnableViewState = False
Dim sw As StringWriter = New StringWriter()
Dim hw As HtmlTextWriter = New HtmlTextWriter(sw)
DataList1.RenderControl(hw)
Response.Write(sw.ToString())
Response.End()
Unfortunately all the format set from css is lost. Is there a way to
get around this?
Regards,
S