wpf documentviewer和简单文本

杰森76

我需要在打印前为用户支付文字并允许打印。我尝试使用DocumentViewer,但是找不到显示简单Text的示例。仅Word或XPS,但它是过时的解决方案。

有什么方法可以打印简单的多行文本抛出DocumentViewer

var printText = @"Multiline text to view and print
Line1 Content
Line2 Content
";

和查看

<DocumentViewer>
    <FixedDocument></FixedDocument>
</DocumentViewer>     

如何使这项工作?

狗仔队

一个FlowDocument的

<FlowDocumentReader xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <FlowDocument>
    <Paragraph>
      <Bold>Some bold text in the paragraph.</Bold>
      Some text that is not bold.
    </Paragraph>
    <List>
      <ListItem>
        <Paragraph>ListItem 1</Paragraph>
      </ListItem>
      <ListItem>
        <Paragraph>ListItem 2</Paragraph>
      </ListItem>
      <ListItem>
        <Paragraph>ListItem 3</Paragraph>
      </ListItem>
    </List>
  </FlowDocument>
</FlowDocumentReader>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章