ControlCollection.AddContentControl Methode

Definition

Überlädt

AddContentControl(ContentControl, String)

Fügt ein neues ContentControl hinzu, das auf einem nativen Inhaltssteuerelement im Dokument basiert.

AddContentControl(String, WdContentControlType)

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

AddContentControl(Range, String, WdContentControlType)

Fügt im angegebenen Bereich im Dokument ein neues ContentControl des angegebenen Typs hinzu.

AddContentControl(ContentControl, String)

Fügt ein neues ContentControl hinzu, das auf einem nativen Inhaltssteuerelement im Dokument basiert.

public:
 Microsoft::Office::Tools::Word::ContentControl ^ AddContentControl(Microsoft::Office::Interop::Word::ContentControl ^ contentControl, System::String ^ name);
public Microsoft.Office.Tools.Word.ContentControl AddContentControl (Microsoft.Office.Interop.Word.ContentControl contentControl, string name);
abstract member AddContentControl : Microsoft.Office.Interop.Word.ContentControl * string -> Microsoft.Office.Tools.Word.ContentControl
Public Function AddContentControl (contentControl As ContentControl, name As String) As ContentControl

Parameter

contentControl
ContentControl

Das Microsoft.Office.Interop.Word.ContentControl, das die Grundlage für das neue Steuerelement ist.

name
String

Der Name des neuen Steuerelements.

Gibt zurück

Das ContentControl, das dem Dokument hinzugefügt wurde.

Ausnahmen

contentControl ist null.-or- name ist null oder hat die Länge null.

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

contentControlist kein Bausteinkatalog (d. h. microsoft.Office.Interop.Word. Die ContentControl.Type-Eigenschaft von contentControl weist nicht den Wert Microsoft.Office.Interop.Word auf. WdContentControlType.wdContentControlRichText).

Hinweise

Verwenden Sie diese Methode, um ein neues ContentControl hinzuzufügen, das auf einem systemeigenen Inhaltssteuerelement im Dokument zur Laufzeit basiert. Dies ist nützlich, wenn Sie ein ContentControl zur Laufzeit erstellen und dasselbe Steuerelement beim nächsten Öffnen des Dokuments neu erstellen möchten. Weitere Informationen finden Sie unter Adding Controls to Office Documents at Run Time.

Gilt für:

AddContentControl(String, WdContentControlType)

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

public:
 Microsoft::Office::Tools::Word::ContentControl ^ AddContentControl(System::String ^ name, Microsoft::Office::Interop::Word::WdContentControlType contentControlType);
public Microsoft.Office.Tools.Word.ContentControl AddContentControl (string name, Microsoft.Office.Interop.Word.WdContentControlType contentControlType);
abstract member AddContentControl : string * Microsoft.Office.Interop.Word.WdContentControlType -> Microsoft.Office.Tools.Word.ContentControl
Public Function AddContentControl (name As String, contentControlType As WdContentControlType) As ContentControl

Parameter

name
String

Der Name des neuen Steuerelements.

contentControlType
WdContentControlType

Einer der Microsoft.Office.Interop.Word.WdContentControlType-Werte, der den zugrunde liegenden Typ des neuen Inhaltssteuerelements angibt.

Gibt zurück

Das ContentControl, das dem Dokument hinzugefügt wurde.

Ausnahmen

name ist null oder hat die Länge 0 (null).

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

Hinweise

Verwenden Sie diese Methode, um zur Laufzeit ein neues ContentControl zur aktuellen Auswahl im Dokument hinzuzufügen. Weitere Informationen finden Sie unter Adding Controls to Office Documents at Run Time.

Gilt für:

AddContentControl(Range, String, WdContentControlType)

Fügt im angegebenen Bereich im Dokument ein neues ContentControl des angegebenen Typs hinzu.

public:
 Microsoft::Office::Tools::Word::ContentControl ^ AddContentControl(Microsoft::Office::Interop::Word::Range ^ range, System::String ^ name, Microsoft::Office::Interop::Word::WdContentControlType contentControlType);
public Microsoft.Office.Tools.Word.ContentControl AddContentControl (Microsoft.Office.Interop.Word.Range range, string name, Microsoft.Office.Interop.Word.WdContentControlType contentControlType);
abstract member AddContentControl : Microsoft.Office.Interop.Word.Range * string * Microsoft.Office.Interop.Word.WdContentControlType -> Microsoft.Office.Tools.Word.ContentControl
Public Function AddContentControl (range As Range, name As String, contentControlType As WdContentControlType) As ContentControl

Parameter

range
Range

Ein Range, der die Grenzen für das neue Steuerelement bereitstellt.

name
String

Der Name des neuen Steuerelements.

contentControlType
WdContentControlType

Einer der Microsoft.Office.Interop.Word.WdContentControlType-Werte, der den zugrunde liegenden Typ des neuen Inhaltssteuerelements angibt.

Gibt zurück

Das ContentControl, das dem Dokument hinzugefügt wurde.

Ausnahmen

name ist null oder hat die Länge 0 (null).

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

Hinweise

Verwenden Sie diese Methode, um zur Laufzeit einen neuen ContentControl in einem angegebenen Bereich im Dokument hinzuzufügen. Weitere Informationen finden Sie unter Adding Controls to Office Documents at Run Time.

Gilt für: