DocumentBase.Subdocuments Özellik
Alır bir Subdocuments belge içindeki alt belgeleri temsil eden bir koleksiyon.
Ad alanı: Microsoft.Office.Tools.Word
Derleme: Microsoft.Office.Tools.Word.v4.0.Utilities (Microsoft.Office.Tools.Word.v4.0.Utilities.dll içinde)
Sözdizimi
'Bildirim
Public ReadOnly Property Subdocuments As Subdocuments
public Subdocuments Subdocuments { get; }
Özellik Değeri
Tür: Microsoft.Office.Interop.Word.Subdocuments
A Subdocuments belge içindeki alt belgeleri temsil eden bir koleksiyon.
Örnekler
Aşağıdaki kod örneği seçimdeki ilk paragrafı Başlık 1 stilini uygular ve sonra seçimin içeriği için bir alt belge oluşturur.Kod daha sonra belgede alt belgelerin sayısını gösteren bir ileti görüntüler.Bu örneği kullanmak için çalıştırın ThisDocument bir belge düzeyi projesinde sınıf.
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 Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. Kısmen güvenilen kod kitaplıklarını kullanma.