Udostępnij za pośrednictwem


DocumentBase.CurrentRsid Property

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

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntax

'Declaration
Public ReadOnly Property CurrentRsid As Integer
    Get
public int CurrentRsid { get; }

Property Value

Type: System.Int32
A random number that Microsoft Office Word assigns to changes in the document.

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.

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 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
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());
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace