1,文档分类:
文档分为流文档(FlowDocument,布局可变)与固定文档(xps,pdf等布局不可变)。
注明:流内容元素继承自ContentElement和FrameworkContenteElement而非常用的UIElement和FrameworkElement
2,文档容器:
流文档(FlowDocument)容器(只读,共三个)。
- FlowDocumentScrollViews:不能分页也不能分列显示。
示例:
<FlowDocumentScrollViewer IsSelectionEnabled="False">
<FlowDocument Background="SkyBlue">
....
</FlowDocument>
</FlowDocumentScrollViewer>
效果:
- FlowDocumentPageViews:可进行分页和分列显示。
示例
<FlowDocumentPageViewer >
<FlowDocument ColumnWidth="200" IsColumnWidthFlexible="True" ColumnRuleBrush="SkyBlue" ColumnRuleWidth="2" ColumnGap="30" >
<Paragraph>
The sixth of August was my mothers birthday.My father and I wanted to give her surprising birthday presents.On their mothersbirthday,I know some of my classmates are going to help their mothers with housework;others are going to the shop and buy some flowers for their mothers.
</Paragraph>
<Paragraph>
In the morning,my father and I went shopping and bought a very nice cake.Then we went to the market and bought some food.When we got home,my father cooked some nice food in the kitchen.I went to my room to make a birthday card.I wanted to say to my mother that I loved her very much.Then I wrote in the card,"I love you,my dear mother!"I put it on her pillow,then we cleaned the room.We felt very tired,but we were very happy.
</Paragraph>
<Paragraph>
My mother got home.We said,"Happy Birthday!"My mother smiled.We had our supper together.My mother said,"Thank you,my daughter!"
</Paragraph>
<Paragraph>
How happy we were!
</Paragraph>
<Paragraph>
<Image Source="Img/1.jpg"></Image>
</Paragraph>
</FlowDocument>
</FlowDocumentPageViewer>
效果:
- FlowDocumentReader:可进行分页和分列显示,同时增加了查找功能,是三个中开销最大的容器。
固定文档容器:
显示格式内容已固定的文档(例如xps文档),一般用于文档预览呈现。
注明:XPS文件实际上是包含压缩文件库的ZIP文件,包含字体,图像以及用于每一页的文本内容,可将XPS的扩展名修改为.zip并打开它。