Free Support Forum - aspose.com

Cells.ImportDataTable always returns no row

Hi,

I have been using Aspose Excel (V 1.8) with Asp .Net for 2 years now. I have an aspose.excel.lic and it is working great but all we do with it is export some SP results into exel files.

On a new VB Winform application, I want to import some datas coming from an excel file.

At first I tried to read it with the cells.Item(0,0).StringValue method and I was having some problems because Excel is not strongly type so I had problems with that method importing if it was a number.

So I tried the method Cells.ImportDataTable but it always return no rows in my dataset. I downloaded the latest hotfix (V 3.6) to find out that there is now an xml file and it does not accept my license file anymore in

Dim oAsposeExcel As Excel = New Excel(sLicenseFile)

Can anyone help me. I realy would like to keep working with this old version of the dll since all my other applications works fin with it.

Thanks

Serge

Hi Serge,

I don't have v1.8 on hand. The earliest backup version is v2.x. Your old dll can still work with your license file.

Since the start of this year, we changed our license schema to facilitate our users. New versions should work with new license file. If you want to upgrade your license file, please post your request at http://www.aspose.com/Community/Forums/220/ShowForum.aspx .

Hi Laurence,

Do you have an idea why the Cells.ImportDataTable returns no row in my datatable ? Is-it because my licence file is not alright. Here is my code that imports an excel vacation schedule.

Private Function ImportVacationGetData(ByRef oAsposeExcel As Excel) As Boolean

Dim oAsposeSheet As Worksheet = oAsposeExcel.Worksheets("TemplateImport")

Dim oAsposeSheetCells As Cells = oAsposeSheet.Cells

_mdtVacationFile = New DataTable("Vacation")

_mdtVacationFile.Columns.Add("PEIN", System.Type.GetType("System.String"))

_mdtVacationFile.Columns.Add("WorkDate", System.Type.GetType("System.String"))

_mdtVacationFile.Columns.Add("VacationCode", System.Type.GetType("System.String"))

Dim i As Integer = oAsposeSheetCells.ImportDataTable(_mdtVacationFile, True, 0, 0)

End Function

Thanks

Serge

How many rows of data in your DataTable? Does this problem occur in v3.6?

The data table is empty (No Rows) before and after the Cells.ImportDataTable method. I want to put the rows of the excel file (Worksheet "TemplateImport") in it. The excel file has 24 rows. If I use V 3.6 with no license file, I have the same problem.

Thanks

ImportDataTable is used to import data from DataTable to Excel file. For your case, please try ExportDataTable or ExportDataTableAsString method.

Sorry, my mistake, I tought it was to import from excel.

I will try this ExportDataTableAsString method

Serge