DocumentBase.Redo(Object) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
执行已撤消的上一个操作(与 Undo(Object) 方法相反)。
public bool Redo (ref object times);
参数
- times
- Object
要重复的操作的数目。
返回
如果操作已成功重复,则为 true。
示例
下面的代码示例向文档中添加了三个单词,两次调用 undo 方法,然后调用 redo 方法一次。 文档中保留了两个单词。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。
private void DocumentRedo()
{
object undoTime = 2;
object redoTime = 1;
this.Paragraphs[1].Range.InsertParagraphBefore();
this.Application.Selection.TypeText("New ");
this.Application.Selection.TypeText("text ");
this.Application.Selection.TypeText("here.");
this.Undo(ref undoTime);
this.Redo(ref redoTime);
}
Private Sub DocumentRedo()
Dim undoTime As Object = 2
Dim redoTime As Object = 1
Me.Paragraphs(1).Range.InsertParagraphBefore()
Me.Application.Selection.TypeText("New ")
Me.Application.Selection.TypeText("text ")
Me.Application.Selection.TypeText("here.")
Me.Undo(undoTime)
Me.Redo(redoTime)
End Sub
注解
可选参数
有关可选参数的信息,请参阅Office 解决方案中的可选参数。