2

I am using Aspose Cells to get data from excel file in each row I have data like this

| Name | PhoneNumber | Email | Group

| Jack | +1456985    |    | Users

When I try to read contact from row with this

((Row)currentContact).GetCellByIndex(2).StringValue

Code gives me "Users" that should returns " " and After that

((Row)currentContact).GetCellByIndex(3).StringValue

that actually should return "Users" But this line throws IndexOutOfBoundException .

It seems that aspose skips empty cells . can anyone help me with this ?

1 Answers1

1

First of all, please note that the recent releases of Aspose.Cells APIs have obsoleted the Row.GetCellByIndex method so it will be removed from the public API very soon. Alternative solution is Row.GetEnumerator method. Regarding your original concerns, both Row.GetCellByIndex and Row.GetEnumerator methods will not list the cells that have not been initialized. In other words, if the specified cell contains even an empty string, it will be read correctly otherwise it will be skipped. You may use Row.GetCellOrNull method to test if a cell has been initialized or not. Please feel free to contact us here or in Aspose.Cells support forum if you have more questions.

I work with Aspose as Developer Evangelist.

Prorata
  • 483
  • 3
  • 10