DocumentBase.Frames 属性

定义

获取一个 Frames 集合,该集合表示文档中的所有框架。

public Microsoft.Office.Interop.Word.Frames Frames { get; }

属性值

Frames

一个 Frames 集合,表示文档中的所有框架。

示例

下面的代码示例向第一个段落添加文本,然后将一个文本框架添加到文本中。 然后,代码将文本框的边框更改为 wdLineStyleDouble 。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。

private void DocumentFrames()
{
    Word.Frame textFrame;
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Paragraphs[1].Range.Text = "Sample paragraph text.";
    textFrame = this.Frames.Add(this.Paragraphs[1].Range);
    textFrame.Borders.OutsideLineStyle = Microsoft.Office.Interop.Word
        .WdLineStyle.wdLineStyleDouble;
}
Private Sub DocumentFrames()
    Dim textFrame As Word.Frame
    Me.Paragraphs(1).Range.InsertParagraphAfter()
    Me.Paragraphs(1).Range.Text = "Sample paragraph text."
    textFrame = Me.Frames.Add(Me.Paragraphs(1).Range)
    textFrame.Borders.OutsideLineStyle = Microsoft.Office.Interop. _
        Word.WdLineStyle.wdLineStyleDouble
End Sub 

适用于