.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

Export html table into sheets of excel

Posted By: oswaldlily     Posted Date: August 29, 2011    Points:5   Category :ASP.Net
I have 3 tables..my first table should come in sheet1 of excel
2nd table should come in sheet2 of excel.
third table should come in sheet3 of excel
is this correct?

Protected Sub lnk1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles lnkExport.Click
Response.Clear()
Response.ClearHeaders()
Response.ContentType = "application\vnd.ms-excel"
Response.AddHeader("Content-disposition", "attachment;filename=Export.xls")
Response.Charset = ""
Dim sw As System.IO.StringWriter = New System.IO.StringWriter()
Dim hw As HtmlTextWriter = New HtmlTextWriter(sw)
literal1.RenderControl(hw)
literal2.RenderControl(hw)
Response.Write(sw.ToString())
Response.End()

Response.Clear()
Response.ClearHeaders()
Response.ContentType = "application\vnd.ms-excel"
Response.AddHeader("Content-disposition", "attachment;filename=Export.xls")
Response.Charset = ""
Dim sw1 As System.IO.StringWriter = New System.IO.StringWriter()
Dim hw1 As HtmlTextWriter = New HtmlTextWriter(sw1)
Literal3.RenderControl(hw1)
Literal4.RenderControl(hw1)
Response.Write(sw1.ToString())
Response.End()

Response.Clear()
Response.ClearHeaders()
Response.ContentType = "application\vnd.ms-excel"
Response.AddHeader("Content-disposition", "attachment;filename=Export.xls")
Response.Charset = ""
'Dim sw2 As System.IO.StringWriter = New System.IO.StringWriter()
Dim hw2 As HtmlTextWriter = New HtmlTextWriter(sw2)
Literal5.RenderControl(hw2)
Literal6.RenderControl(hw2)
Response.Write(sw2.ToString())
Response.End()
End Sub


Responses
Author: Gowthammanju             
Posted Date: September 05, 2011     Points: 20   

try these link as

http://www.dotnetfunda.com/articles/article1131-export-large-data-from-gridview-to-excel-file-using-csharp-.aspx
[URL]
http://www.dotnetfunda.com/forums/thread548-export-data-to-excel-file-from-a-table-in-sql-server-using-csharp.aspx [/URL]

http://forums.asp.net/t/1214938.aspx/1?How+to+transfer+html+table+data+into+excel+sheet+

http://social.msdn.microsoft.com/Forums/pl-PL/exceldev/thread/514f54e7-1360-4ab1-af27-42ba9987f530

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: jackadision             
Posted Date: March 18, 2014     Points: 20   

To do this conversion use any converter because it can easily convert html to excel file without loss of data. But in manual method data loss may occurs. Free download this tool from http://www.softwaredownloadcentre.com/software/html-to-excel-converter.php




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend