مشاركة عبر


DocumentBase.TablesOfContents الخاصية

يحصل TablesOfContentsالمجموعة التي تمثل الجداول من المحتويات في التطبيق.

مساحة الاسم:  Microsoft.Office.Tools.Word
التجميع:  Microsoft.Office.Tools.Word.v4.0.Utilities (في Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

بناء الجملة

'إقرار
Public ReadOnly Property TablesOfContents As TablesOfContents
    Get
public TablesOfContents TablesOfContents { get; }

قيمة الخاصية

النوع: Microsoft.Office.Interop.Word.TablesOfContents
TablesOfContentsالمجموعة التي تمثل الجداول محتويات في مستند.

أمثلة

يلي تعليمات برمجية المثال يضيف فقرتين في مستند وقم بتعيين أنماط عنوان 1 والعنوان 2 للفقرات. تعليمات برمجية ثم يقوم بإنشاء جدول المحتويات عند يؤشر الإدراج التي تتضمن الفقرات تطبيق نمط عنوان 1. إلى لاستخدام هذا المثال، قم بتشغيلها من ThisDocumentالفئة في مشروع المستوى مستند.

Private Sub DocumentTablesOfContents()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "Heading 1"
    Me.Paragraphs(2).Range.Text = "Heading 2"

    Dim Style1 As Object = Word.WdBuiltinStyle.wdStyleHeading1
    Me.Paragraphs(1).Style = Style1

    Dim Style2 As Object = Word.WdBuiltinStyle.wdStyleHeading2
    Me.Paragraphs(2).Style = Style2

    Dim HeadingLevel As Object = 1
    Me.TablesOfContents.Add(Me.Application.Selection.Range, , HeadingLevel, _
        HeadingLevel)
End Sub 
private void DocumentTablesOfContents()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Text = "Heading 1";
    this.Paragraphs[2].Range.Text = "Heading 2";

    object Style1 = Word.WdBuiltinStyle.wdStyleHeading1;
    this.Paragraphs[1].set_Style(ref Style1);

    object Style2 = Word.WdBuiltinStyle.wdStyleHeading2;
    this.Paragraphs[2].set_Style(ref Style2);

    object HeadingLevel = 1;
    this.TablesOfContents.Add(this.Application.Selection.Range,
        ref missing, ref HeadingLevel, ref HeadingLevel,
        ref missing, ref missing, ref missing, ref missing,
        ref missing, ref missing, ref missing, ref missing);
}

أمن NET Framework.

راجع أيضًَا

المرجع

DocumentBase الفئة

DocumentBase الأعضاء

Microsoft.Office.Tools.Word مساحة الاسم