Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

New Comment on "Inserting and Deleting Rows"

$
0
0
I am experiencing the exact some issue... My full code sample (sample doc omitted): using (var workbook = loadWorkbook(fileContent)) { using (var sheet = workbook.Worksheets.FirstOrDefault()) { var successRows = sheet.RowsUsed( (row) => { var lastUsedCell = row.LastCellUsed(); return lastUsedCell != null && lastUsedCell.Value != null && lastUsedCell.Value.ToString() == "Success"; }); successRows.Delete(); var memStream = new MemoryStream(); workbook.SaveAs(memStream); memStream.Seek(0, SeekOrigin.Begin); return memStream; } } Basically just looking for cell's that equal success and removing them from the doc and then saving off to a memory stream... When i later retrieve this workbook from the stream all rows are deleted including the headers... Any help would be greatly appreciated!! I have tried to just foreach over the success records and remove one at a time, this works but is way to slow for the larger documents i have to process.

Viewing all articles
Browse latest Browse all 1877

Trending Articles