ControlCollection.AddBuildingBlockGalleryContentControl Yöntem (String)
Yeni bir ekler BuildingBlockGalleryContentControl belgedeki geçerli seçime.
Ad alanı: Microsoft.Office.Tools.Word
Derleme: Microsoft.Office.Tools.Word (Microsoft.Office.Tools.Word.dll içinde)
Sözdizimi
'Bildirim
Function AddBuildingBlockGalleryContentControl ( _
name As String _
) As BuildingBlockGalleryContentControl
BuildingBlockGalleryContentControl AddBuildingBlockGalleryContentControl(
string name
)
Parametreler
- name
Tür: System.String
Yeni denetimin adı.
Dönüş Değeri
Tür: Microsoft.Office.Tools.Word.BuildingBlockGalleryContentControl
BuildingBlockGalleryContentControl Belgeye eklenmiştir.
Özel Durumlar
Exception | Koşul |
---|---|
ArgumentNullException | nameolan nullnull başvuru (Visual Basic'te Nothing) veya sıfır uzunlukta. |
ControlNameAlreadyExistsException | Aynı ada sahip bir denetim zaten kullanılıyor ControlCollection. |
Notlar
Yeni bir eklemek için bu yöntemi kullanın BuildingBlockGalleryContentControl zamanında belgedeki geçerli seçime.Daha fazla bilgi için bkz. Office Belgelerine Çalışma Zamanında Denetim Ekleme.
Örnekler
Aşağıdaki kod örneği ekler yeni bir BuildingBlockGalleryContentControl belgenin başına.BuildingBlockGalleryContentControl Microsoft Office Word tarafından sağlanan bir Denklem yapı taşlarını görüntüler.
Belge düzeyi özelleştirmesinde sürümüdür.Bu kodu kullanmak için içine yapıştırın ThisDocument sınıfı proje ve çağrı AddBuildingBlockControlAtSelection yönteminden ThisDocument_Startup yöntem.
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;
}
Bir uygulama düzeyi eklentisi hedefler de için bu sürümü olan .NET Framework 4 veya .NET Framework 4.5.Bu kodu kullanmak için içine yapıştırın ThisAddIn sınıfı proje ve çağrı AddBuildingBlockControlAtSelection yönteminden ThisAddIn_Startup yöntem.
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;
}
.NET Framework Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen Güvenilen Koddan Kitaplıkları Kullanma.
Ayrıca bkz.
Başvuru
AddBuildingBlockGalleryContentControl Fazla Yük
Microsoft.Office.Tools.Word Ad Alanı