Aracılığıyla paylaş


DropDownListContentControl.DropDownListEntries Özellik

Tarafından görüntülenen öğeler koleksiyonu alır DropDownListContentControl.

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

Sözdizimi

'Bildirim
ReadOnly Property DropDownListEntries As ContentControlListEntries
ContentControlListEntries DropDownListEntries { get; }

Özellik Değeri

Tür: Microsoft.Office.Interop.Word.ContentControlListEntries
A ContentControlListEntries tarafından görüntülenen öğeleri içeren nesne DropDownListContentControl.

Notlar

Eklediğinizde, bir DropDownListContentControl bir belge için onu hiçbir öğe varsayılan olarak içerir.Öğe eklemek için Add yöntemi, DropDownListEntries özelliği.

Örnekler

Aşağıdaki kod örneği ekler yeni bir DropDownListContentControl belgenin başına.Bu örnek kullanır DropDownListEntries birkaç gün adlarını denetimde kullanıcılar öğeler listesine eklemek üzere özellik.

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

Dim dropDownListControl1 As Microsoft.Office.Tools.Word.DropDownListContentControl

Private Sub AddDropDownListControlAtSelection()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Select()
    dropDownListControl1 = Me.Controls.AddDropDownListContentControl("dropDownListControl1")
    With dropDownListControl1
        .DropDownListEntries.Add("Monday", "Monday", 0)
        .DropDownListEntries.Add("Tuesday", "Tuesday", 1)
        .DropDownListEntries.Add("Wednesday", "Wednesday", 2)
        .PlaceholderText = "Choose a day"
    End With
End Sub
private Microsoft.Office.Tools.Word.DropDownListContentControl dropDownListControl1;

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

    dropDownListControl1 = this.Controls.AddDropDownListContentControl("dropDownListControl1");
    dropDownListControl1.DropDownListEntries.Add("Monday", "Monday", 0);
    dropDownListControl1.DropDownListEntries.Add("Tuesday", "Tuesday", 1);
    dropDownListControl1.DropDownListEntries.Add("Wednesday", "Wednesday", 2);
    dropDownListControl1.PlaceholderText = "Choose a day";
}

Bir uygulama düzeyinde eklenti değildir.Bu kodu kullanmak için içine Yapıştır ThisAddIn sınıfı proje ve çağrı AddDropDownListControlAtSelection yönteminden ThisAddIn_Startup yöntemi.

Dim dropDownListControl1 As Microsoft.Office.Tools.Word.DropDownListContentControl

Private Sub AddDropDownListControlAtSelection()
    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()
    dropDownListControl1 = vstoDoc.Controls.AddDropDownListContentControl("dropDownListControl1")
    With dropDownListControl1
        .DropDownListEntries.Add("Monday", "Monday", 0)
        .DropDownListEntries.Add("Tuesday", "Tuesday", 1)
        .DropDownListEntries.Add("Wednesday", "Wednesday", 2)
        .PlaceholderText = "Choose a day"
    End With
End Sub
private Microsoft.Office.Tools.Word.DropDownListContentControl dropDownListControl1;

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

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

    dropDownListControl1 = vstoDoc.Controls.AddDropDownListContentControl("dropDownListControl1");
    dropDownListControl1.DropDownListEntries.Add("Monday", "Monday", 0);
    dropDownListControl1.DropDownListEntries.Add("Tuesday", "Tuesday", 1);
    dropDownListControl1.DropDownListEntries.Add("Wednesday", "Wednesday", 2);
    dropDownListControl1.PlaceholderText = "Choose a day";
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

DropDownListContentControl Arabirim

Microsoft.Office.Tools.Word Ad Alanı