共用方式為


DocumentBase.FormFields Property

Gets a FormFields collection that represents all the form fields 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 FormFields As FormFields
public FormFields FormFields { get; }

Property Value

Type: Microsoft.Office.Interop.Word.FormFields
A FormFields collection that represents all the form fields in the document.

Examples

The following code example adds a check box form field to the first paragraph in the document. To use this example, run it from the ThisDocument class in a document-level project.

Private Sub DocumentFormFields()
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.FormFields.Add(Me.Paragraphs(1).Range, Microsoft.Office.Interop.Word. _
        WdFieldType.wdFieldFormCheckBox)
End Sub
private void DocumentFormFields()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.FormFields.Add(this.Paragraphs[1].Range,
        Microsoft.Office.Interop.Word.WdFieldType.wdFieldFormCheckBox);
}

.NET Framework Security

See Also

Reference

DocumentBase Class

Microsoft.Office.Tools.Word Namespace