Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Export datalist to Excel - css format is lost!

Reply
Thread Tools

Export datalist to Excel - css format is lost!

 
 
staeri@gmail.com
Guest
Posts: n/a
 
      03-14-2006
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

 
Reply With Quote
 
 
 
 
=?Utf-8?B?dmJwaGls?=
Guest
Posts: n/a
 
      04-05-2006
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


"(E-Mail Removed)" 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
>
>

 
Reply With Quote
 
 
 
 
Dracs
Guest
Posts: n/a
 
      05-23-2006

what did u do?


http://www.velocityreviews.com/forums/(E-Mail Removed) 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



-
Drac
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

 
Reply With Quote
 
Patrick.O.Ige
Guest
Posts: n/a
 
      05-24-2006
Dracs
see Steve's article http://steveorr.net/articles/ExcelExport.aspx
Patrick

"Dracs" <(E-Mail Removed)> wrote in message
news(E-Mail Removed)...
>
> what did u do?
>
>
> (E-Mail Removed) 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 *

>
>
>
> --
> Dracs
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export to Excel (Default File Type - Excel) =?Utf-8?B?SGVtYW50IFNpcGFoaW1hbGFuaQ==?= ASP .Net 15 05-21-2009 12:01 PM
Export datalist or gridview to Excel staeri@gmail.com ASP .Net 2 03-07-2006 08:19 PM
using Microsoft Excel image for Export to Excel button =?Utf-8?B?U3JpZGhhcg==?= ASP .Net 0 12-09-2005 08:58 PM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
Invalid export DLL or export format =?Utf-8?B?RGF2aWQgVmFsbGU=?= ASP .Net 0 10-29-2003 11:46 AM



Advertisments