.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

Rectify my error in copyin html table to excel

Posted By: oswaldlily     Posted Date: September 07, 2011    Points:5   Category :ASP.Net
Condition1)First table should be in left side of first excel sheet and
second table should be in right side of first excel sheet
*Just little movement not to the extreme
My error is:Table not copyin 2 excel
Response.Clear()
Response.AddHeader("Content-disposition", "attachment;filename=excel.xls")
Response.Charset = ""
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.ContentType = "application/vnd.ms-excel"
Response.Buffer = True
Me.EnableViewState = False

Dim FileName As String = "MyXls/excel.xls"
'*** Create Excel.Application ***'
Dim xlApp As New Excel.Application
Dim xlBook As Excel.Workbook
'Dim xlCells As Excel.Range
xlBook = xlApp.Workbooks.Add()
xlBook.Application.Visible = False
'*** Create Sheet 1 ***'
Dim sw As System.IO.StringWriter = New System.IO.StringWriter()
sw.Write(xlBook)
With xlApp.ActiveSheet
xlBook.Worksheets(1).Name = "Employee details"
xlBook.Worksheets(1).Select()
..................(has html table here)....................
"Called html table here and my table is in table1"
literal1.Text = table1 (now i stored my html table in literals)
From this literals it should export to my first sheet of excelsheet.(name-Employee details)
sw.Write(literal1)
End With

// second table starts
With xlApp.ActiveSheet
literal2.Text = table2
Dim sw2 As System.IO.StringWriter = New System.IO.StringWriter()
sw2.write(literal2)

End With

Responses

No response found. Be the first to respond this post
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