deleting rows from an excel file using c#

后端 未结 2 817
一向
一向 2020-12-11 06:46

I am opening an excel file like this:

Excel.Application xlApp;
Excel.Workbook xlWorkBook;
Excel.Worksheet xlWorkSheet;
Excel.Range range;

string str;
int rC         


        
2条回答
  •  失恋的感觉
    2020-12-11 07:29

     for (int i = dt.Rows.Count - 1; i >= 0; i--)
     {
         if (dt.Rows[i][1].ToString() == "SomeThing")
         {
             dt.Rows.RemoveAt(i);
         }
     }
    

提交回复
热议问题