We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

DeleteBlankRows - empty rows are still in sheet

Hi,

in the attached file there are only two rows.
Why the rowcount in Aspose.Cells is 5 and why the empty rows are not removed after calling DeleteBlankRows?

Thanks



var file = “C:\sl1r.xls”;
var workbook = new Aspose.Cells.Workbook(file);
var r1 = workbook.Worksheets[0].Cells.Rows.Count; // =5
var r2 = workbook.Worksheets[0].Cells.MaxDataRow; // =4
workbook.Worksheets[0].Cells.DeleteBlankRows();
var r3 = workbook.Worksheets[0].Cells.Rows.Count; // =5
var r4 = workbook.Worksheets[0].Cells.MaxDataRow; // =4



Hi,

Thanks for your posting and using Aspose.Cells for .NET.

We have looked into your issue and found that none of your rows are blanks.

The 3rd, 4th and 5th rows has cells with empty strings. Please check the following code and its output. As you see in the output, blank cells are shown as IsNull while non-blank cells are shown as IsString.

We will also look into this issue if the cells with empty string values could be treated as blank cells and this issue could be avoided in future releases.

We have logged this issue in our database with the issue id: CELLSNET-41212

Once, we will have some update for you, we will let you know asap.

C#


string filePath = @“F:\Shak-Data-RW\Downloads\sl1r.xls”;


var workbook = new Aspose.Cells.Workbook(filePath);


Worksheet worksheet = workbook.Worksheets[0];


Range range = worksheet.Cells.MaxDisplayRange;


for (int i = 0, r = range.FirstRow; i < range.RowCount; i++, r++)

{

for (int j = 0, c = range.FirstColumn; j < range.ColumnCount; j++, c++)

{

Cell cell = worksheet.Cells[r,c];


string str = cell.StringValue;


Debug.WriteLine("[" + r + “,” + c + “]” + cell.ToString());

}


}


Debug Output:
[0,0]Aspose.Cells.Cell [ A1; ValueType : IsString; Value : v ]
[0,1]Aspose.Cells.Cell [ B1; ValueType : IsString; Value : p1 ]
[0,2]Aspose.Cells.Cell [ C1; ValueType : IsString; Value : p2 ]
[0,3]Aspose.Cells.Cell [ D1; ValueType : IsString; Value : a ]
[1,0]Aspose.Cells.Cell [ A2; ValueType : IsString; Value : 00121 ]
[1,1]Aspose.Cells.Cell [ B2; ValueType : IsString; Value : 11135 ]
[1,2]Aspose.Cells.Cell [ C2; ValueType : IsString; Value : 11138 ]
[1,3]Aspose.Cells.Cell [ D2; ValueType : IsString; Value : ]
[2,0]Aspose.Cells.Cell [ A3; ValueType : IsNull ]
[2,1]Aspose.Cells.Cell [ B3; ValueType : IsNull ]
[2,2]Aspose.Cells.Cell [ C3; ValueType : IsNull ]
[2,3]Aspose.Cells.Cell [ D3; ValueType : IsString; Value : ]
[3,0]Aspose.Cells.Cell [ A4; ValueType : IsNull ]
[3,1]Aspose.Cells.Cell [ B4; ValueType : IsNull ]
[3,2]Aspose.Cells.Cell [ C4; ValueType : IsNull ]
[3,3]Aspose.Cells.Cell [ D4; ValueType : IsString; Value : ]
[4,0]Aspose.Cells.Cell [ A5; ValueType : IsNull ]
[4,1]Aspose.Cells.Cell [ B5; ValueType : IsNull ]
[4,2]Aspose.Cells.Cell [ C5; ValueType : IsNull ]
[4,3]Aspose.Cells.Cell [ D5; ValueType : IsString; Value : ]

Hi,

Well, we have treated cells with empty string as blank cells in the method Cells.DeleteBlankRows. We could not directly load those cells as blank cells because it would be different if a formula refers to them.


Thank you.

The issues you have found earlier (filed as CELLSNET-41212) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.