Question

I've created a program that returns specific columns from an Excel File through Spreadsheet Gear. Here is my While Loop:

     while (Worksheet.Cells[ExcelRow, 1].Value != null)
     { //to do code here
     }

When null, my code returns empty cells of rows - even though I specified here not to.

It returns 0 for all cells that are empty in the data grid. Is there a way not display cells that are empty in the Excel File?

Was it helpful?

Solution

You can determine the used cells using the SpreadsheetGear API. Try using:

    IWorksheet.UsedRange

SpreadsheetGear Reference

This will return the used portion of the spreadsheet as an IRange.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top