共用方式為


BuildingBlockGalleryContentControl.BuildingBlockCategory 屬性 (2007 系統)

更新: 2008 年 7 月

取得或設定在 BuildingBlockGalleryContentControl 中顯示的建置組塊分類。

命名空間:  Microsoft.Office.Tools.Word
組件:  Microsoft.Office.Tools.Word.v9.0 (在 Microsoft.Office.Tools.Word.v9.0.dll 中)

語法

Public Property BuildingBlockCategory As String

Dim instance As BuildingBlockGalleryContentControl
Dim value As String

value = instance.BuildingBlockCategory

instance.BuildingBlockCategory = value
public string BuildingBlockCategory { get; set; }

屬性值

型別:System.String

BuildingBlockGalleryContentControl 中顯示的建置組塊分類。

備註

所有建置組塊都屬於某個分類和陳列庫。使用 BuildingBlockCategory 屬性指定 BuildingBlockGalleryContentControl 所顯示的建置組塊分類。您可以將這個屬性的值設定為 Microsoft Office Word 所定義的 Built-In 或 General 分類,或指定自訂的分類。

若要指定在 BuildingBlockGalleryContentControl 中所顯示的建置組塊庫,請使用 BuildingBlockType 屬性。

範例

下列程式碼範例會將新的 BuildingBlockGalleryContentControl 加入至文件的開頭。BuildingBlockGalleryContentControl 會顯示 Microsoft Office Word 所提供的方程式建置組塊 (Building Block)。這個範例會將 BuildingBlockCategory 屬性設定為 Built-In 分類。

這是示範文件層級自訂的版本。若要使用這段程式碼,請將它貼到專案的 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 = Me.Application.ActiveDocument.GetVstoObject()
    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 = this.Application.ActiveDocument.GetVstoObject();
    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;
}

使用權限

請參閱

參考

BuildingBlockGalleryContentControl 類別

BuildingBlockGalleryContentControl 成員

Microsoft.Office.Tools.Word 命名空間

變更記錄

日期

記錄

原因

2008 年 7 月

加入應用程式層級增益集的程式碼範例版本。

SP1 功能變更。