ControlCollection.AddContentControl メソッド (ContentControl, String) (2007 System)
更新 : 2007 年 11 月
文書内のネイティブなコンテンツ コントロールに基づく新しい ContentControl を追加します。
名前空間 : Microsoft.Office.Tools.Word
アセンブリ : Microsoft.Office.Tools.Word.v9.0 (Microsoft.Office.Tools.Word.v9.0.dll 内)
構文
'宣言
Public Function AddContentControl ( _
contentControl As ContentControl, _
name As String _
) As ContentControl
'使用
Dim instance As ControlCollection
Dim contentControl As ContentControl
Dim name As String
Dim returnValue As ContentControl
returnValue = instance.AddContentControl(contentControl, _
name)
public ContentControl AddContentControl(
ContentControl contentControl,
string name
)
パラメータ
contentControl
型 : Microsoft.Office.Interop.Word.ContentControl新しいコントロールの基礎となる Microsoft.Office.Interop.Word.ContentControl。
name
型 : System.String新しいコントロール名。
戻り値
型 : Microsoft.Office.Tools.Word.ContentControl
文書に追加された ContentControl。
例外
例外 | 条件 |
---|---|
ArgumentNullException | contentControl が nullnull 参照 (Visual Basic では Nothing) です。 または name が nullnull 参照 (Visual Basic では Nothing) であるか、または長さが 0 である場合。 |
ControlNameAlreadyExistsException | 同じ名前のコントロールが既に ControlCollection に存在する場合。 |
ArgumentException | contentControl は文書パーツ ギャラリーではありません (contentControl の Microsoft.Office.Interop.Word.ContentControl.Type プロパティに値 Microsoft.Office.Interop.Word.WdContentControlType.wdContentControlRichText が設定されていません)。 |
解説
このメソッドを使用して、実行時に文書内に既に存在するネイティブなコンテンツ コントロールに基づく新しい ContentControl を追加します。これは、実行時に ContentControl を作成し、この次に文書を開くときに同じコントロールを再作成する場合に便利です。詳細については、「実行時の Office ドキュメントへのコントロールの追加」を参照してください。
アクセス許可
- 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。