Private Function GetExcelCellEnumerator(row As Row, rowCount As Integer) As List(Of Cell) Dim currentCount As Integer = 0 Dim result = New List(Of Cell) For Each cell As Cell In row.Descendants(Of Cell)() Dim columnName As String = GetColumnName(cell.CellReference) Dim currentColumnIndex As Integer = ConvertColumnNameToNumber(columnName) While currentCount < currentColumnIndex 'Here where I'm getting the error when the "cell.CellValue" is nothing' Dim emptycell = New Cell() With { _ .DataType = New EnumValue(Of CellValues)(CellValues.SharedString), _ .CellValue = New CellValue(cell.CellValue.ToString)} currentCount += 1 emptycell.AppendChild(New SharedStringItem(New DocumentFormat.OpenXml.Spreadsheet.Text(Nothing))) result.Add(emptycell) End While result.Add(cell) currentCount += 1 Next Return result End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)