次の方法で共有


BuildingBlockGalleryContentControl インターフェイス

ユーザーが文書に挿入できる、文書のビルド ブロックのギャラリを表します。

名前空間:  Microsoft.Office.Tools.Word
アセンブリ:  Microsoft.Office.Tools.Word (Microsoft.Office.Tools.Word.dll 内)

構文

'宣言
<GuidAttribute("d8d887a2-69fe-4a86-a8dd-352003dc0e7e")> _
Public Interface BuildingBlockGalleryContentControl _
    Inherits ContentControlBase, IBindableComponent, IComponent, IDisposable,  _
    ISupportInitialize
[GuidAttribute("d8d887a2-69fe-4a86-a8dd-352003dc0e7e")]
public interface BuildingBlockGalleryContentControl : ContentControlBase, 
    IBindableComponent, IComponent, IDisposable, ISupportInitialize

BuildingBlockGalleryContentControl 型で公開されるメンバーは以下のとおりです。

プロパティ

  名前 説明
パブリック プロパティ Application Microsoft Office Word の現在のインスタンスを表す Microsoft.Office.Interop.Word.Application を取得します。
パブリック プロパティ BindingContext IBindableComponent の CurrencyManager のコレクションを取得または設定します。 (IBindableComponent から継承されます。)
パブリック プロパティ BuildingBlockCategory BuildingBlockGalleryContentControl に表示されるビルド ブロックのカテゴリを取得または設定します。
パブリック プロパティ BuildingBlockType BuildingBlockGalleryContentControl に表示されるビルド ブロックの種類を取得または設定します。
パブリック プロパティ Container インフラストラクチャ。 (ContentControlBase から継承されます。)
パブリック プロパティ ContainerComponent インフラストラクチャ。 (ContentControlBase から継承されます。)
パブリック プロパティ Creator BuildingBlockGalleryContentControl が作成されたアプリケーションを示す 32 ビット整数を取得します。
パブリック プロパティ DataBindings このIBindableComponent のデータ バインディング オブジェクトのコレクションを取得します。 (IBindableComponent から継承されます。)
パブリック プロパティ DefaultDataSourceUpdateMode ContentControlBase の既定の DataSourceUpdateMode を取得または設定します。 (ContentControlBase から継承されます。)
パブリック プロパティ DefaultTextStyle BuildingBlockGalleryContentControl 内のテキストへの書式設定に使用する、文字スタイルの名前を取得します。
パブリック プロパティ ID コンテンツ コントロールを示す一意の数字を取得します。 (ContentControlBase から継承されます。)
パブリック プロパティ InnerObject Microsoft.Office.Tools.Word.ContentControlBase の基になる Microsoft.Office.Interop.Word.ContentControl オブジェクトを取得します。 (ContentControlBase から継承されます。)
パブリック プロパティ LockContentControl BuildingBlockGalleryContentControl を文書から削除できるかどうかを指定する値を取得または設定します。
パブリック プロパティ LockContents BuildingBlockGalleryContentControl のコンテンツを編集できるかどうかを指定する値を取得または設定します。
パブリック プロパティ Parent BuildingBlockGalleryContentControl の親を取得します。
パブリック プロパティ ParentContentControl 別のコンテンツ コントロールに入れ子になっている BuildingBlockGalleryContentControl の親コンテンツ コントロールを取得します。
パブリック プロパティ PlaceholderText ユーザーによる操作やその他の操作によってテキストが変更されない限り、BuildingBlockGalleryContentControl に表示されるテキストを取得または設定します。
パブリック プロパティ Range BuildingBlockGalleryContentControl のコンテンツを表す Range を取得します。
パブリック プロパティ ShowingPlaceholderText BuildingBlockGalleryContentControl が現在表示されているプレースホルダー テキストであるかどうかを示す値を取得します。
パブリック プロパティ Site IComponent に関連付けられた ISite を取得または設定します。 (IComponent から継承されます。)
パブリック プロパティ Tag BuildingBlockGalleryContentControl に関連付ける文字列を取得または設定します。
パブリック プロパティ Temporary コントロールが編集されたときに文書から BuildingBlockGalleryContentControl を自動的に削除するかどうかを指定する値を取得または設定します。
パブリック プロパティ Text BuildingBlockGalleryContentControl 内のテキストを取得または設定します。
パブリック プロパティ Title BuildingBlockGalleryContentControl のタイトルを取得または設定します。

このページのトップへ

メソッド

  名前 説明
パブリック メソッド BeginInit 初期化の開始を通知するシグナルをオブジェクトに送信します。 (ISupportInitialize から継承されます。)
パブリック メソッド Copy 文書からクリップボードに、BuildingBlockGalleryContentControl をコピーします。
パブリック メソッド Cut BuildingBlockGalleryContentControl を文書から削除し、クリップボードに追加します。
パブリック メソッド Delete 動的に作成されたコンテンツ コントロールを、文書から削除し、さらに文書内の ControlCollection から削除します。 (ContentControlBase から継承されます。)
パブリック メソッド Dispose アンマネージ リソースの解放およびリセットに関連付けられているアプリケーション定義のタスクを実行します。 (IDisposable から継承されます。)
パブリック メソッド EndInit 初期化の完了を通知するシグナルをオブジェクトに送信します。 (ISupportInitialize から継承されます。)
パブリック メソッド SetPlaceholderText Microsoft.Office.Interop.Word.BuildingBlockRange、または BuildingBlockGalleryContentControl 内にプレースホルダー テキストとして存在する文字列にあるテキストを表示します。

このページのトップへ

イベント

  名前 説明
パブリック イベント Added コンテンツ コントロールが文書に追加された後に発生します。 (ContentControlBase から継承されます。)
パブリック イベント BindingContextChanged ContentControlBaseBindingContext プロパティの値が変更された場合に発生します。 (ContentControlBase から継承されます。)
パブリック イベント ContentUpdating コンテンツ コントロールがカスタム XML 部分にバインドされている場合、Microsoft Office Word がコンテンツ コントロール内のテキストを更新する直前に発生します。 (ContentControlBase から継承されます。)
パブリック イベント Deleting コンテンツ コントロールが文書から削除される直前に発生します。 (ContentControlBase から継承されます。)
パブリック イベント Disposed コンポーネントの Disposed イベントを処理するメソッドを表します。 (IComponent から継承されます。)
パブリック イベント Entering ユーザーがコンテンツ コントロールをクリックしたとき、またはプログラムによってカーソルがコンテンツ コントロール内に移動したときに発生します。 (ContentControlBase から継承されます。)
パブリック イベント Exiting ユーザーがコンテンツ コントロールの外部をクリックしたとき、またはプログラムによってカーソルがコンテンツ コントロールの外部に移動したときに発生します。 (ContentControlBase から継承されます。)
パブリック イベント StoreUpdating コンテンツ コントロールにバインドされているカスタム XML 部分にあるデータを Microsoft Office Word が更新する直前 (コンテンツ コントロール内のテキストが変更された後) に発生します。 (ContentControlBase から継承されます。)
パブリック イベント Validated コンテンツ コントロールの検証が正常に完了したときに発生します。 (ContentControlBase から継承されます。)
パブリック イベント Validating コンテンツ コントロール内のコンテンツを検証中であるときに発生します。 (ContentControlBase から継承されます。)

このページのトップへ

解説

BuildingBlockGalleryContentControl は、ユーザーが文書に挿入できる、文書のビルド ブロックの一覧を表示します。 文書のビルド ブロックは、複数回使用できるように作成されたコンテンツ部分です。たとえば、共通の表紙、書式設定された表、ヘッダーなどが挙げられます。 表示するビルド ブロックを選択するには、BuildingBlockCategory プロパティと BuildingBlockType プロパティを使用します。

文書のビルド ブロックの詳細については、「What's New for Developers in Word 2007」を参照してください。

注意

これは、Visual Studio Tools for Office Runtime によって実装されたインターフェイスです。コードに実装されるものではありません。詳細については、「Visual Studio Tools for Office Runtime の概要」を参照してください。

コンテンツ コントロール

Microsoft Office Word には、文書やテンプレートのデザインに使用できるコンテンツ コントロールが 8 種類あります。BuildingBlockGalleryContentControl は、そのコンテンツ コントロールの 1 つです。 コンテンツ コントロールには、フォームと同様に、入力を制御するユーザー インターフェイス (UI) があります。 コンテンツ コントロールを使用して、保護されている文書やテンプレートのセクションをユーザーが編集しないようにすることができます。また、コンテンツ コントロールをデータ ソースにバインドすることも可能です。 詳細については、「コンテンツ コントロール」を参照してください。

使用方法

ここでは、.NET Framework 4 および .NET Framework 4.5 を対象とする Office プロジェクトで使用される型のバージョンについて説明します。.NET Framework 3.5 を対象とするプロジェクトでは、この型のメンバーが異なること、およびこのコード例が動作しないことがあります。.NET Framework 3.5 を対象とするプロジェクトの型の詳細については、Visual Studio 2008 ドキュメントの参照セクション https://go.microsoft.com/fwlink/?LinkId=160658 を参照してください。

次のコード例は、文書の先頭に新しい BuildingBlockGalleryContentControl を追加します。 BuildingBlockGalleryContentControl は、Microsoft Office Word によって提供される数式のビルド ブロックを表示します。

このバージョンは、ドキュメント レベルのカスタマイズに使用されます。 このコードを使用するには、プロジェクトの ThisDocument クラスにコードを貼り付け、ThisDocument_Startup メソッドから AddBuildingBlockControlAtSelection メソッドを呼び出します。

Dim buildingBlockGalleryControl1 As Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl

Private Sub AddBuildingBlockGalleryControlAtSelection()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Select()
    buildingBlockGalleryControl1 = Me.Controls.AddBuildingBlockGalleryContentControl( _
        "buildingBlockGalleryControl1")
    With buildingBlockGalleryControl1
        .PlaceholderText = "Choose an equation"
        .BuildingBlockCategory = "Built-In"
        .BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations
    End With
End Sub
private Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl buildingBlockControl1;

private void AddBuildingBlockControlAtSelection()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Select();

    buildingBlockControl1 = this.Controls.AddBuildingBlockGalleryContentControl(
        "buildingBlockControl1");
    buildingBlockControl1.PlaceholderText = "Choose an equation";
    buildingBlockControl1.BuildingBlockCategory = "Built-In";
    buildingBlockControl1.BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations;
}

このバージョンは、アプリケーション レベルのアドインに使用されます。 このコードを使用するには、プロジェクトの ThisAddIn クラスにコードを貼り付け、ThisAddIn_Startup メソッドから AddBuildingBlockControlAtSelection メソッドを呼び出します。

Dim buildingBlockGalleryControl1 As BuildingBlockGalleryContentControl

Private Sub AddBuildingBlockGalleryControlAtSelection()
    If Me.Application.ActiveDocument Is Nothing Then
        Return
    End If

    Dim vstoDoc As Document = Globals.Factory.GetVstoObject(Me.Application.ActiveDocument)
    vstoDoc.Paragraphs(1).Range.InsertParagraphBefore()
    vstoDoc.Paragraphs(1).Range.Select()
    buildingBlockGalleryControl1 = vstoDoc.Controls.AddBuildingBlockGalleryContentControl( _
        "buildingBlockGalleryControl1")
    With buildingBlockGalleryControl1
        .PlaceholderText = "Choose an equation"
        .BuildingBlockCategory = "Built-In"
        .BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations
    End With
End Sub
private Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl buildingBlockControl1;

private void AddBuildingBlockControlAtSelection()
{
    if (this.Application.ActiveDocument == null)
        return;

    Document vstoDoc = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);
    vstoDoc.Paragraphs[1].Range.InsertParagraphBefore();
    vstoDoc.Paragraphs[1].Range.Select();

    buildingBlockControl1 = vstoDoc.Controls.AddBuildingBlockGalleryContentControl(
        "buildingBlockControl1");
    buildingBlockControl1.PlaceholderText = "Choose an equation";
    buildingBlockControl1.BuildingBlockCategory = "Built-In";
    buildingBlockControl1.BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations;
}

参照

関連項目

Microsoft.Office.Tools.Word 名前空間

その他の技術情報

コンテンツ コントロール

方法 : Word 文書にコンテンツ コントロールを追加する

方法 : コンテンツ コントロールを使用して文書を保護する

チュートリアル : コンテンツ コントロールによるテンプレートの作成