Free Support Forum - aspose.com

Read Data From XLS

Hi,

I’v created a xls file with MS Excel 2002 and put it to my web folder. In a later version this file should be uploaded by users and processed - but in a first step a manual copy should be enough. I attached my test excel file (number 12345 is written in SHeet 0 on A1)

I tried to read this file with Excel.Aspose 3.2.4.0. I used code from one of your examples.


File = "IMportTest.xls"
ReadFileAS(File)

Private Sub ReadFileAS(ByVal File As String)

Dim i As Integer = 0
Dim excel As Excel = New Excel
Dim designerFile As String = Page.MapPath(File)

excel.Open(designerFile)
Dim sheet As Worksheet = excel.Worksheets(0)
’ try to read cell A1 in sheet 0
Dim dt As DataTable = sheet.Cells.ExportDataTable(0, 0, 1, 1)

For i = 0 To dt.Rows.Count - 1
str = dt.Rows(i).Item(0).ToString
Next

End Sub

In datatable no number is stored - every time i run the application another string value is displayed. A sample is Z9l6c4nhEoHAE. It seems to be a hash code or anything that.

Any idea how i get the 12345 value from cell A1 in sheet 0?

Thanks a lot
Kind regards
Stefan

i forgot - i’m using an evaluation copy of Aspose.Excel

update about our testing activities. maybe it helps to solve the problem.

It seems to be a problem with number values. We place a string value in B1 and read. No problems.

We mask a number value with ’ - no success. The value returned is always a hash code.

Putting values works without problems for strings, numbers, booleans etc.

Any ideas how we can catch number values? What we have to do? Converting the excel file to string or anything else?


Thanks in advance
Stefan

Hi Stefan,

It’s evaluation limitation instead of a bug. Please check http://www.aspose.com/wiki/default.aspx/Aspose.Excel/LicensingComponent.html for reference.

You can try to add some data in Cell F20. You will find now Cell A1 will work fine.