簡體   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