MiniExcel
MiniExcel copied to clipboard
怎么删除某一行呢?
static void DeleteEmptyRow(string excelPath, string excelName, string sheetName)
{
string path = $"{excelPath}/{excelName}.xlsx";
var rows = MiniExcel.Query(path, useHeaderRow:true, sheetName).ToList();
int line = 1;
foreach (IDictionary<string,object> row in rows)
{
line ++;
if(row.Values.All(d=>d==null)){
// MiniExcel.Delete(line); //没有类似的接口吗?
}
}
}
流模式不建议有删除模式,可以重新读取重新保存
多谢答复,已经通过对空行的检测并在开发环境中发出警报log,然后交给相关人员去手动修改源Excel.
发件人: Wei Lin @.> 发送时间: 2024年5月13日 13:17 收件人: mini-software/MiniExcel @.> 抄送: samolulu @.>; Author @.> 主题: Re: [mini-software/MiniExcel] 怎么删除某一行呢? (Issue #591)
流模式不建议有删除模式,可以重新读取重新保存
― Reply to this email directly, view it on GitHubhttps://github.com/mini-software/MiniExcel/issues/591#issuecomment-2107556695, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKZ73EODGR7CMIC26IPRQQLZCC4PPAVCNFSM6AAAAABHITDEXGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMBXGU2TMNRZGU. You are receiving this because you authored the thread.Message ID: @.***>