I'm converting a VB6 program that reads Excel files. In VB6, we used the UsedRange property of the worksheet. I don't see any equivalent property in the Infragistics Excel engine.
I've tried 2 approaches. My first attempt was to iterate through the Worksheet.Columns collection to determine the number of columns (since there's no Count property in this collection) and then use GetCellValue for each possible index value. This worked for some files, but in others it appeared that there were hundreds (or thousands) of extra columns which caused severe performance problems. My second attempt was to use the Cells collection of each row. The problem with this is that it skips empty cells in the middle of the row, so columns in the resulting rows don't align properly.
Is there any method to read the region of the worksheet that corresponds to the UsedRange in Excel?
Hello,
Thanks for providing your solution.
Please let us know if you need any further assistance.
To answer my own question, I was able to use the ColumnIndex property of the cell to determine when cells were skipped in a row.