大马资讯论坛 - 马来西亚中文资讯平台

标题: C# Excel 删除指定行 Excel delete row [打印本页]

作者: 资讯王    时间: 2010-12-22 16:40
标题: C# Excel 删除指定行 Excel delete row
C# Excel 删除指定行 Excel delete row
ws = worksheet

删除一行 To delete a single row this way:
  1. Excel.Range ran;
  2. ran = (Excel.Range)this.Application.Rows[12, missing];
  3. ran.Select();
  4. ran.Delete(Microsoft.Office.Interop.Excel.XlDirection.xlUp);

复制代码
同时连续删除多行To delete multiple rows:

  1. //Get a set of cells in the rows
  2. Excel.Range rng = ws.get_Range("a12", "A14");
  3. //Then act on the entire rows of the range
  4. rng.EntireRow.Delete(Excel.XlDirection.xlUp);
复制代码





欢迎光临 大马资讯论坛 - 马来西亚中文资讯平台 (http://www.freeinfo.com.my/) Powered by Discuz! X3.3