cell.CellValue.Text returning 0 instead of 0009 from Spreadsheet RRS feed

  • Question

  • Well title says it all, Iam having a cell in my spreadsheet having the value 00009 (with error in spreadsheet saying Number stored as text).
    I want to read the wole value (00009) and not just 0 into a datarow, how can I do that?

    Here's my code:


            Private Function FillDataStFromWorkSheet(ByVal worksheet As Worksheet, ByVal schemaName As String) As DataSet
                Dim ds As New DataSet
                ds.Locale = System.Globalization.CultureInfo.InvariantCulture
                ds.EnforceConstraints = True
                Dim dataRow As DataRow
                Dim ColumnsCount As Int32 = ds.Tables(0).Columns.Count
                For Each sheetRow As Row In worksheet.Descendants(Of Row)() '.Descendants(Of Row)().Where(Function(r) r.RowIndex.Value >= 1 AndAlso r.RowIndex.Value <= 32)
                    Dim indexItem = 0
                    dataRow = ds.Tables(0).NewRow
                    For Each cell As Cell In sheetRow
                        dataRow.Item(indexItem) = cell.CellValue.Text
                        indexItem += 1
                Return ds
            End Function

    Thursday, May 14, 2009 7:49 AM

All replies