TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
prabhu p
NA
181
115k
How to export data to excel using gembox.spreedsheet dll
Aug 16 2016 10:25 AM
I want to download excel with multipe sheet,I passing two datatable for two sheets table for sheet1 and table1 for sheet2, while i submit excel downloading no issuse while opening excel file iam getting dialog box with error
Error occur when wps spreed sheet opening this file
Make sure you are permitted to access file
Make sure have enough space
I want to know wheather my code is coorect or not
and function is below
Public Sub ExportToSpreadsheet(ByVal table As DataTable, ByVal table1 As DataTable, ByVal name As String)
Try
Dim attachment As String = "attachment; filename=" & name & Format(CDate(Now), "_ddMMyyyy_hhmmss") & ".xls"
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.AddHeader("content-disposition", attachment)
Response.Buffer = True
Response.Charset = ""
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"
HttpContext.Current.Response.Write(vbLf)
Dim ef As ExcelFile
ef = New ExcelFile()
Dim ws As ExcelWorksheet
ws = ef.Worksheets.Add("Summary")
Dim ws1 As ExcelWorksheet
ws1 = ef.Worksheets.Add("MissingData")
ws.InsertDataTable(table, "A1", True)
ws1.InsertDataTable(table1, "A1", True)
Dim MyMemoryStream As New MemoryStream()
ef.SaveXls(MyMemoryStream)
MyMemoryStream.WriteTo(Response.OutputStream)
Catch excp As Exception
Errors.WriteToErrorLogWithUserName(excp, "", Session("UserName").ToString())
End Try
End Sub
Please do need full to us
Reply
Answers (
2
)
How to use a WebUtility.HtmlDecode() function in MVC 4 .net
web form 2010 display error message