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!!

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>