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.
Unfortunately, activation email could not send to your email. Please try again.

Workbooks.Open(xlsPath) failed

Thread ID:

Created:

Updated:

Platform:

Replies:

117064 Aug 1,2014 05:46 AM Aug 10,2014 08:54 PM Windows Forms 3
loading
Tags: XlsIO
Yujin Wu
Asked On August 1, 2014 05:46 AM

Hi Team,

I want to open an .xlsx file and save it to .csv format, however error throws out when it is executed
at the code .Workbooks.Open(xlsPath);

below is my code:

            using (ExcelEngine excel = new ExcelEngine()) {
                IApplication app = excel.Excel;
                IWorkbook workbook = app.Workbooks.Open(xlsPath);
                workbook.Worksheets[0].SaveAs(csvPath, ",", Encoding.Default);
                workbook.Close();
            }

Could you help figure out what's wrong with it, could you paste correct code?

Thanks,
Wuyj


Attachment: ZZD_ZC_0725_fb5cf726.zip

Yujin Wu
Replied On August 2, 2014 04:05 AM

The problem is resolved when I updated the version to 12.2.0.36.

Dilli Babu Nandha Gopal [Syncfusion]
Replied On August 4, 2014 02:54 AM

Hi Yujin,

Thanks for Updating us, regarding this issue.This issue has been fixed and let us know if have any concern.

Regards,
Dilli babu

Bill Penrose
Replied On August 10, 2014 08:54 PM

Using this example I have run the code below but nothing appears in the form. I am missing something obvious. The datatable definitely has rows and items.

http://www.syncfusion.com/kb/1937/how-do-i-create-a-simple-spreadsheet-using-xlsio

Private Sub frmMaster_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
     
 If DSMaster.Tables.Count = 0 Then
            GetSpreadsheet(MasterFile, DSMaster)
        End If

        ' A new instance of the Excel Application is created
        Dim excelEngine As New ExcelEngine()
        Dim application As IApplication = excelEngine.Excel
        application.DefaultVersion = ExcelVersion.Excel97to2003
        ' A new workbook object [bookOne] is created
        Dim bookOne As IWorkbook = excelEngine.Excel.Workbooks.Create(1)
        Dim sheet As IWorksheet = bookOne.Worksheets(0)

        sheet.ImportDataTable(DSMaster.Tables("Master"), True, 1, 1, -1, -1) ', True)
 
End Sub


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.

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.

;