ControlCollection.AddContentControl-Methode (String, WdContentControlType)

Fügt bei der aktuellen Auswahl im Dokument ein neues ContentControl des angegebenen Typs hinzu.

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

Syntax

'Declaration
Function AddContentControl ( _
    name As String, _
    contentControlType As WdContentControlType _
) As ContentControl
ContentControl AddContentControl(
    string name,
    WdContentControlType contentControlType
)

Parameter

Rückgabewert

Typ: Microsoft.Office.Tools.Word.ContentControl
Das ContentControl, das dem Dokument hinzugefügt wurde.

Ausnahmen

Ausnahme Bedingung
ArgumentNullException

name ist nullNULL-Verweis (Nothing in Visual Basic) oder hat die Länge 0 (null).

ControlNameAlreadyExistsException

Ein Steuerelement mit dem gleichen Namen ist bereits in der ControlCollection vorhanden.

Hinweise

Verwenden Sie diese Methode, um bei der aktuellen Auswahl im Dokument zur Laufzeit ein neues ContentControl hinzuzufügen. Weitere Informationen finden Sie unter Hinzufügen von Steuerelementen zu Office-Dokumenten zur Laufzeit.

.NET Framework-Sicherheit

Siehe auch

Referenz

ControlCollection Schnittstelle

AddContentControl-Überladung

Microsoft.Office.Tools.Word-Namespace