繁体   English   中英

wpf documentviewer和简单文本

[英]wpf documentviewer and simple text

我需要在打印之前为用户支付文字并允许打印。 我尝试使用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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM