DocumentBase.CurrentRsid 属性

定义

获取 Microsoft Office Word 指派给文档中更改的一个随机数。

public int CurrentRsid { get; }

属性值

Int32

Microsoft Office Word 分配给文档中更改的一个随机数。

示例

下面的代码示例显示了一个消息框,其中显示属性的值 CurrentRsid 。 然后,该代码将文本添加到第一个段落,保存该文档,然后显示另一个消息框,其中显示属性的修改后的值 CurrentRsid 。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

private void GetDocumentCurrentRsid()
{
    MessageBox.Show("CurrentRsid value before saving changes: " 
        + this.CurrentRsid.ToString());
    this.Paragraphs[1].Range.Text = "Inserting some text...";
    this.Save();
    MessageBox.Show("CurrentRsid value after saving changes: " 
        + this.CurrentRsid.ToString());
}
Private Sub GetDocumentCurrentRsid()
    MessageBox.Show("CurrentRsid value before saving changes: " _
                    + Me.CurrentRsid.ToString())
    Me.Paragraphs(1).Range.Text = "Inserting some text..."
    Me.Save()
    MessageBox.Show("CurrentRsid value after saving changes: " _
                    + Me.CurrentRsid.ToString())
End Sub

注解

如果 StoreRSIDOnSave 属性的属性 Options 为,则 true 每次保存文档时,Word 都会生成一个随机数,应用程序将使用该数字来简化和合并文档。 Word 将随机数存储在表中,并在每次保存后更新该表。 CurrentRsid属性返回 Word 分配给文档的最后一个数字。

适用于