Aracılığıyla paylaş


ControlCollection.AddBuildingBlockGalleryContentControl Yöntem (Range, String)

Yeni bir ekler BuildingBlockGalleryContentControl adresindeki belgeyi belirtilen aralıkta.

Ad alanı:  Microsoft.Office.Tools.Word
Derleme:  Microsoft.Office.Tools.Word (Microsoft.Office.Tools.Word.dll içinde)

Sözdizimi

'Bildirim
Function AddBuildingBlockGalleryContentControl ( _
    range As Range, _
    name As String _
) As BuildingBlockGalleryContentControl
BuildingBlockGalleryContentControl AddBuildingBlockGalleryContentControl(
    Range range,
    string name
)

Parametreler

Dönüş Değeri

Tür: Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl
BuildingBlockGalleryContentControl Belgeye eklenmiştir.

Özel Durumlar

Exception Koşul
ArgumentNullException

nameise nullnull başvuru (Visual Basic'te Nothing) veya sıfır uzunlukta.

ControlNameAlreadyExistsException

Aynı ada sahip bir denetim içinde ControlCollection.

Notlar

Yeni eklemek için bu yöntemi kullanın BuildingBlockGalleryContentControl adresinde belirtilen aralıkta belge çalışma zamanında.Daha fazla bilgi için bkz. Belgeye Çalışma Zamanında Denetim Ekleme.

Örnekler

Aşağıdaki kod örneği, yeni bir ekler BuildingBlockGalleryContentControl belgenin başına.BuildingBlockGalleryContentControl Microsoft Office Word tarafından sağlanan bir Denklem yapı taşları görüntüler.

Belge düzeyinde özelleştirme için değildir.Bu kodu kullanmak için içine yapıştırın ThisDocument sınıfı proje ve çağrı AddBuildingBlockControlAtRange yönteminin ThisDocument_Startup yöntemi.

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

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

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

    buildingBlockControl2 = this.Controls.AddBuildingBlockGalleryContentControl(
       this.Paragraphs[1].Range, "buildingBlockControl2");
    buildingBlockControl2.PlaceholderText = "Choose an equation";
    buildingBlockControl2.BuildingBlockCategory = "Built-In";
    buildingBlockControl2.BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations;
}

Bir uygulama düzeyinde hedefleyen eklentisi için değil .NET Framework 4.Bu kodu kullanmak için içine yapıştırın ThisAddIn sınıfı proje ve çağrı AddBuildingBlockControlAtRange yönteminin ThisAddIn_Startup yöntemi.

Dim buildingBlockGalleryControl2 As BuildingBlockGalleryContentControl

Private Sub AddBuildingBlockGalleryControlAtRange()
    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()
    buildingBlockGalleryControl2 = vstoDoc.Controls.AddBuildingBlockGalleryContentControl( _
        vstoDoc.Paragraphs(1).Range, "buildingBlockGalleryControl2")
    With buildingBlockGalleryControl2
        .PlaceholderText = "Choose an equation"
        .BuildingBlockCategory = "Built-In"
        .BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations
    End With
End Sub
private Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl buildingBlockControl2;

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

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

    buildingBlockControl2 = vstoDoc.Controls.AddBuildingBlockGalleryContentControl(
       vstoDoc.Paragraphs[1].Range, "buildingBlockControl2");
    buildingBlockControl2.PlaceholderText = "Choose an equation";
    buildingBlockControl2.BuildingBlockCategory = "Built-In";
    buildingBlockControl2.BuildingBlockType = Word.WdBuildingBlockTypes.wdTypeEquations;
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

ControlCollection Arabirim

AddBuildingBlockGalleryContentControl Fazla Yük

Microsoft.Office.Tools.Word Ad Alanı

Diğer Kaynaklar

Belgeye Çalışma Zamanında Denetim Ekleme

Nasıl yapılır: Word belgeleri için içerik denetimleri ekleme