We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

xlsio saveas

Thread ID:

Created:

Updated:

Platform:

Replies:

101206 Oct 6,2011 05:51 PM UTC Oct 7,2011 08:40 AM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: XlsIO
Navin
Asked On October 6, 2011 05:51 PM UTC

Hi,

I am using XlsIO to export data from datatable to excel. Everything works fine but it errors out at .saveas. Also I am not sure what to be entered for Response in the workbook.Saveas parameter.

Please advice.

Thanks,
Navin

Below is the code:

Shared Sub ExportValidation(ByVal tblName As String)
Dim oleAdp As OleDbDataAdapter
Dim ds As DataSet
Dim dt As DataTable

Dim sql As String = "SELECT * FROM tbl" & tblName

oleAdp = New OleDbDataAdapter(sql, cnn)
ds = New DataSet
oleAdp.Fill(ds)

dt = New DataTable
dt = ds.Tables(0)

Dim excelEngine As ExcelEngine = New ExcelEngine
Dim application As IApplication = excelEngine.Excel
application.DefaultVersion = ExcelVersion.Excel97to2003

Dim wbk As IWorkbook = application.Workbooks.Create(1)
Dim wks As IWorksheet = wbk.Worksheets(0)

If Not dt.Rows.Count = 0 Then
wks.ImportDataTable(dt, True, 1, 1)
End If

wbk.SaveAs("ContactValidationOutput.xls", ExcelSaveType.SaveAsXLS, Response, ExcelHttpContentType.CSV)
wbk.Close()
excelEngine.Dispose()

End Sub


Sridhar [Syncfusion]
Replied On October 7, 2011 08:40 AM UTC

Hi Navin,

Thank you for using Syncfusion products.

We are unable to reproduce the reported issue at our side. We have tried the sample at our side to reproduce the above reported issue by importing the data table and saveas method and we are not able to see any issues at our side with that sample.
We have attached the sample for your reference.

Please try the sample at your side and let us know if these helps you. If you still face the issue, please get back to us with the simplified sample and the stack trace for the reported error.

Please let me know if you require any further clarifications.

Thanks,
Sridhar.S



SaveAs_786ae38f.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;