Share via


DocumentBase.ListTemplates 속성

문서에 대한 모든 목록 형식을 나타내는 ListTemplates 컬렉션을 가져옵니다.

네임스페이스:  Microsoft.Office.Tools.Word
어셈블리:  Microsoft.Office.Tools.Word.v4.0.Utilities(Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

구문

‘선언
Public ReadOnly Property ListTemplates As ListTemplates
    Get
public ListTemplates ListTemplates { get; }

속성 값

형식: Microsoft.Office.Interop.Word.ListTemplates
문서에 대한 모든 목록 형식을 나타내는 ListTemplates 컬렉션

예제

다음 코드 예제에서는 처음 두 단락에 텍스트를 추가하고, 단락에 목록 템플릿을 적용한 다음, 문서의 목록 수를 보여 주는 메시지를 표시합니다. 이 예제를 사용하려면 문서 수준 프로젝트 ThisDocument 클래스에서 실행하십시오.

Private Sub DocumentLists()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.InsertParagraphAfter()

    Me.Paragraphs(1).Range.Text = "This is the first paragraph."
    Me.Paragraphs(2).Range.Text = "This is the second paragraph."

    Dim Start As Object = Me.Paragraphs(1).Range.Start
    Dim [End] As Object = Me.Paragraphs(2).Range.End
    Dim myRange As Word.Range = Me.Range(Start, [End])
    Dim index As Object = 1

    Dim myTemplate As Word.ListTemplate = Application.ListGalleries( _
        Microsoft.Office.Interop.Word.WdListGalleryType.wdNumberGallery). _
        ListTemplates.Item(index)

    myRange.ListFormat.ApplyListTemplate(myTemplate)

    MessageBox.Show("Total lists in document: " & Me.Lists.Count.ToString())
End Sub 
private void DocumentLists()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.InsertParagraphAfter();


    this.Paragraphs[1].Range.Text = "This is the first paragraph.";
    this.Paragraphs[2].Range.Text = "This is the second paragraph.";

    object Start = this.Paragraphs[1].Range.Start;
    object End = this.Paragraphs[2].Range.End;
    Word.Range myRange = this.Range(ref Start,
        ref End);
    object index = 1;

    Word.ListTemplate myTemplate = Application.ListGalleries[Microsoft.Office.Interop.Word.WdListGalleryType.wdNumberGallery].ListTemplates.get_Item(ref index);

    myRange.ListFormat.ApplyListTemplate(myTemplate, 
        ref missing, ref missing, ref missing);

    MessageBox.Show ("Total lists in document: " +
        this.Lists.Count.ToString());

}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

DocumentBase 클래스

Microsoft.Office.Tools.Word 네임스페이스