مشاركة عبر


DocumentBase.Subdocuments الخاصية

تحصل على Subdocumentsمجموعة الذي يمثل الجميع المستندات الثانوية في مستند.

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

بناء الجملة

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

قيمة الخاصية

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

أمثلة

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

Private Sub DocumentSubdocuments()
    Dim style As Object = Word.WdBuiltinStyle.wdStyleHeading1

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "This is sample text."
    Dim currentRange As Word.Range = Me.Paragraphs(1).Range
    currentRange.Select()
    Me.Application.Selection.Paragraphs(1).Style = style

    Me.Subdocuments.Expanded = True
    Me.Subdocuments.AddFromRange(Application.Selection.Range)

    MessageBox.Show("Total subdocuments: " & Me.Subdocuments.Count.ToString())
End Sub 
private void DocumentSubdocuments()
{
    object style = Word.WdBuiltinStyle.wdStyleHeading1;

    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Text = "This is sample text.";
    Word.Range currentRange = this.Paragraphs[1].Range;
    currentRange.Select();
    this.Application.Selection.Paragraphs[1].set_Style(ref style);

    this.Subdocuments.Expanded = true;
    this.Subdocuments.AddFromRange(Application.Selection.Range);

    MessageBox.Show("Total subdocuments: " + this.Subdocuments.Count.ToString());
}

أمن NET Framework.

راجع أيضًَا

المرجع

DocumentBase الفئة

DocumentBase الأعضاء

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