Proprietà Document.Subdocuments (System 2007)

Aggiornamento: novembre 2007

Ottiene un insieme di Subdocuments che rappresenta tutti i documenti secondari del documento.

Spazio dei nomi:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Sintassi

<BrowsableAttribute(False)> _
Public ReadOnly Property Subdocuments As Subdocuments

Dim instance As Document
Dim value As Subdocuments

value = instance.Subdocuments
[BrowsableAttribute(false)]
public Subdocuments Subdocuments { get; }

Valore proprietà

Tipo: Microsoft.Office.Interop.Word.Subdocuments

Insieme di Subdocuments che rappresenta tutti i documenti secondari del documento.

Esempi

Nell'esempio di codice riportato di seguito viene illustrato come applicare lo stile Intestazione 1 al primo paragrafo della selezione e come creare un documento secondario per il contenuto della selezione. Nell'esempio viene quindi illustrato come visualizzare un messaggio contenente il numero di documenti secondari del documento.

Questo esempio è per una personalizzazione a livello di documento.

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());
}

Autorizzazioni

Vedere anche

Riferimenti

Document Classe

Membri Document

Spazio dei nomi Microsoft.Office.Tools.Word