次の方法で共有


DocumentBase.Sections プロパティ

文書内のセクションを表す Sections コレクションを取得します。

名前空間:  Microsoft.Office.Tools.Word
アセンブリ:  Microsoft.Office.Tools.Word.v4.0.Utilities (Microsoft.Office.Tools.Word.v4.0.Utilities.dll 内)

構文

'宣言
Public ReadOnly Property Sections As Sections
public Sections Sections { get; }

プロパティ値

型 : Microsoft.Office.Interop.Word.Sections
文書内のセクションを表す Sections コレクション。

文書の最初の段落にテキストを追加し、このテキストの前に新しいセクションを追加するコード例を次に示します。 この例を使用するには、これをドキュメント レベルのプロジェクトの ThisDocument クラスから実行します。

Private Sub DocumentSections()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Me.Paragraphs(1).Range.Text = "This is sample text."
    Dim Range As Object = Me.Paragraphs(1).Range

    Me.Sections.Add(Range)
End Sub 
private void DocumentSections()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    this.Paragraphs[1].Range.Text = "This is sample text.";
    object Range = this.Paragraphs[1].Range;

    this.Sections.Add(ref Range, ref missing);
}

.NET Framework セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

DocumentBase クラス

Microsoft.Office.Tools.Word 名前空間