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

 找回密码
 注册
搜索
打印 上一主题 下一主题

C# Excel 删除指定行 Excel delete row

[复制链接]
跳转到指定楼层
1#
发表于 2010-12-22 16:40:51 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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);
复制代码

手机版|大马资讯论坛  

GMT+8, 2024-12-18 03:02 , Processed in 0.023859 second(s), 12 queries , File On.

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表