Blank Cells in Aspose.Cells

Hi ,

I am trying to insert Blank\Empty Cells in a Worksheet.
My issue is even if the cells is Blank it is getting counted.ie in Excel if we select cells in row we get the count of only cells containing data.How is this possible with the help of aspose ?
I require the exact count of cells having data only as this issue is conflicting with Excel macros.
Please reply me ASAP.

Regards,

Hi,


There is no such feature or direct way but you may do it quite easily by using very simplest lines of code, see the sample code below for your reference:

Sample code:

Workbook excel = new Workbook(“e:\test2\Bk_countcells.xlsx”);
Worksheet worksheet = excel.Worksheets[0];
Cells cells = worksheet.Cells;
int cnt = 0;
foreach (Aspose.Cells.Cell cell in cells)
{
//Scan only 6th row cells to count the cells having data
if(cell.Row == 5)
{
if (cell.StringValue.Trim() != “”)
{
cnt++;
string val = cell.StringValue;
}
}
}

MessageBox.Show("Total cells count having data: " + cnt);

Thank you.