mini-software / MiniExcel

Fast, Low-Memory, Easy Excel .NET helper to import/export/template spreadsheet (support Linux, Mac)
https://www.nuget.org/packages/MiniExcel/
Apache License 2.0
2.66k stars 325 forks source link

怎么删除某一行呢? #591

Open samolulu opened 4 months ago

samolulu commented 4 months ago
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);     //没有类似的接口吗?
        }

    }
}
shps951023 commented 3 months ago

流模式不建议有删除模式,可以重新读取重新保存

samolulu commented 3 months ago

多谢答复,已经通过对空行的检测并在开发环境中发出警报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: @.***>