Sdílet prostřednictvím


DocumentBase.Final Property

Definition

Gets or sets a value that indicates whether the document is final.

public:
 property bool Final { bool get(); void set(bool value); };
public bool Final { get; set; }
member this.Final : bool with get, set
Public Property Final As Boolean

Property Value

true if the document is final; otherwise, false.

Examples

The following code example retrieves the Final property of the current document. If the document is not already final, the code shows a message that informs the user that the document is not final, and then sets the Final property to true. Word also displays a message before the document is marked final. If the document is already final, the code shows a message that informs the user that the document is already final. To use this example, run it from the ThisDocument class in a document-level project.

private void SetDocumentToFinal()
{
    if (this.Final == false)
    {
        MessageBox.Show("The current document is not final. Setting " 
            + "it to be final.");
        this.Final = true;
    }
    else
    {
        MessageBox.Show("The current document is final.");
    }
}
Private Sub SetDocumentToFinal()
    If Me.Final = False Then
        MessageBox.Show("The current document is not final. " + _
                        "Setting it to be final.")
        Me.Final = True
    Else
        MessageBox.Show("The current document is final.")
    End If
End Sub

Remarks

If you set this property to true, Microsoft Office Word marks the document as final, notifies recipients (if any) that the document is final, and sets the document to read-only.

Applies to