Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
Loading empty cells
posted

I tried referencing this thread:

http://es.infragistics.com/community/forums/p/71482/361380.aspx

But I still don't get it.  I tried accessing my workbook object with a for loop like this:

int columns = Workbook.Worksheets[0].Rows[0].Cells.Count();
            int rows = Workbook.Worksheets[0].Rows.Count();

            for (int row = 1; row < rows; row++)
            {
                for (int column = 0; column < columns; column++)
                {
                    var data = Workbook.Worksheets[0].Rows[row].Cells[column].Value.ToString();
                }
            }

I still get null reference exceptions whenever it hits a blank cell.  Could someone kindly provide a code example of how to achieve the following:

"Actually, if you would like to get all cells, empty or not, an indexed based approach is the way to go. Use a for loop to access rows in order and then the cells of each row in order. The rows and cells which were not loaded from the file will be lazily created and returned from the indexer."

Many thanks!

Parents Reply Children
No Data