how to export htmltable to excel

Posted by Oswaldlily under ASP.NET on 8/27/2011 | Points: 10 | Views : 2749 | Status : [Member] | Replies : 1
I need to export my htmltable to excel..
My html table is in literals.
I have link button-link1
when i click this link1 my html table shd export to excel file..
my excel file name is Book1.xlsx which is empty at present.

at present my coding is
Response.Clear()
Response.ContentType = "application/ms-excel"
Response.AddHeader("Content-disposition", "attachment;filename=Book1.xlsx")
Dim sw As System.IO.StringWriter = New System.IO.StringWriter()
Dim hw As HtmlTextWriter = New HtmlTextWriter(sw)
literals1.RenderControl(hw)

Response.Write(sw.ToString())
Response.End()
how to do this..can any1 suggest me ?




Responses

Posted by: SheoNarayan on: 8/27/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Read this article http://www.dotnetfunda.com/articles/article977-pdf-generator-in-net-dynamically-generate-pdf-in-aspnet-.aspx, Emphasis on "Generate .pdf dynamically in .NET with custom text and download" section.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Oswaldlily, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response