DocumentBase.StoryRanges 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个 StoryRanges 集合,该集合表示文档中的所有内容。
public Microsoft.Office.Interop.Word.StoryRanges StoryRanges { get; }
属性值
一个 StoryRanges 集合,表示文档中的所有内容。
示例
下面的代码示例将文本添加到文档页眉,然后显示一条显示标头文本的消息。 若要使用此示例,请在 ThisDocument 文档级项目的类中运行它。
private void DocumentStoryRanges()
{
this.Sections[1].Headers[Word.WdHeaderFooterIndex.
wdHeaderFooterPrimary].Range.Text =
"Header text";
MessageBox.Show (this.StoryRanges[
Word.WdStoryType.wdPrimaryHeaderStory].Text);
}
Private Sub DocumentStoryRanges()
Me.Sections(1).Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range.Text _
= "Header text"
MessageBox.Show(Me.StoryRanges(Word.WdStoryType.wdPrimaryHeaderStory).Text)
End Sub