Quantcast
Channel: EPPlus Issue Tracker Rss Feed
Viewing all articles
Browse latest Browse all 2262

Edited Unassigned: Issue with clearing CellRange larger then 1024 rows [15213]

$
0
0
Hello,

I found a problem when clearing a large cellrange. I want to clear all the data from a worksheet expect the header:

```
var cellRange = excelWorksheet.Cells[2, 1, excelWorksheet.Dimension.End.Row, excelWorksheet.Dimension.End.Column];
cellRange.Clear();
```

The code above works perfectly if the worksheet is smaller then 1024 rows. But if the range is larger, the .Clear() method refuses to delete cells after row 1024 until row 2900~ (the larger the dimension, the smaller the number that is skipped for deletion).

Recalling the .Clear() method does not work. The only thing I found to work is setting the range to exactly start from 1024 (not 1023, not 1025) when you call the .Clear() a second time:

```
var cellRange = excelWorksheet.Cells[1024, 1, excelWorksheet.Dimension.End.Row, excelWorksheet.Dimension.End.Column];
cellRange.Clear();
```

In the attachment is a sample to show the problem.

Thx,
Sven

Viewing all articles
Browse latest Browse all 2262

Trending Articles