情况是这样的:我的选择是表格中的两行数据,我想删除这两行。当我使用下面的代码时,行中的内容被删除了,但行仍然存在。所以,我的问题这是:如何删除整行?谢谢。顺便说一句,我使用“书签”来操作选择。
/// <summary>
/// Delete table row
/// </summary>
/// <param name="bookmark"></param>
public void DeleteTableRow(string bookmark)
{
object oBookmark = bookmark;
if (doc.Bookmarks.get_Item(ref oBookmark) != null) {
doc.Bookmarks.get_Item(ref oBookmark).Select();
object wdLine = WdUnits.wdLine;
object wdParagraph = WdUnits.wdParagraph;
object wdTableRow = WdUnits.wdRow;
object wdCharacter = WdUnits.wdCharacter;
object wdExtend = WdMovementType.wdExtend;
object oCount = 1;
Selection selection = app.Selection;
selection.HomeKey(ref wdLine, ref nullobj);
selection.MoveDown(ref wdLine, ref oCount, ref wdExtend);
selection.Delete(ref wdCharacter, ref nullobj);
}
}