次の方法で共有


Bookmark.Sections プロパティ

Bookmark コントロール内のセクションを表す Sections コレクションを取得します。

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

構文

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

プロパティ値

型 : Microsoft.Office.Interop.Word.Sections
Bookmark コントロール内のセクションを表す Sections コレクション。

次のコード例は、テキストを指定して Bookmark コントロールを文書に追加し、Next pageのセクション区切りをブックマーク内の 4 番目の語の前に挿入します。

この例は、ドキュメント レベルのカスタマイズ用に作成されています。

Private Sub BookmarkInsertBreak()
    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "This text will have a section break."
    Bookmark1.Words(4).InsertBreak(Word.WdBreakType _
        .wdSectionBreakNextPage)

    MessageBox.Show("bookmark1 contains " & _
        Bookmark1.Sections.Count.ToString & " sections.")

End Sub
private void BookmarkInsertBreak()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This text will have a section break.";

    object Type = Word.WdBreakType.wdSectionBreakNextPage;
    bookmark1.Words[4].InsertBreak(ref Type);
    MessageBox.Show("bookmark1 contains " + bookmark1.Sections.Count +
        " sections.");
}

.NET Framework セキュリティ

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

参照

関連項目

Bookmark インターフェイス

Microsoft.Office.Tools.Word 名前空間