共用方式為


DocumentBase.CurrentRsid Property

Definition

Gets a random number that Microsoft Office Word assigns to changes in the document.

public:
 property int CurrentRsid { int get(); };
public int CurrentRsid { get; }
member this.CurrentRsid : int
Public ReadOnly Property CurrentRsid As Integer

Property Value

A random number that Microsoft Office Word assigns to changes in the document.

Examples

The following code example shows a message box that displays the value of the CurrentRsid property. The code then adds text to the first paragraph, saves the document, and then shows a second message box that displays the modified value of the CurrentRsid property. To use this example, run it from the ThisDocument class in a document-level project.

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

Remarks

If the StoreRSIDOnSave property of the Options property is true, each time a document is saved, Word generates a random number that the application uses to facilitate comparing and merging documents. Word stores the random numbers in a table and updates the table after each save. The CurrentRsid property returns the last number that Word assigned to the document.

Applies to