[UWP]从c#中的richeditbox打印的最佳方式 [英] [UWP]Best way to print from a richeditbox in c#

查看:130
本文介绍了[UWP]从c#中的richeditbox打印的最佳方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在互联网上搜索过,我没有找到好的文档,我看到其他人抱怨它很复杂,但是我不知道从哪里开始,然后有一个richeditbox和按钮在richeditbox中打印文本,
如果有人有这方面的经验,这对我的工作和其他许多人都非常有帮助。


谢谢你。


编辑,现在我有了编写丰富编辑框的代码

 Text1.Document.GetText(TextGetOptions.UseCrlf,out var值); 
string text = value; ;
RichEditBox richTextBlock = new RichEditBox();
richTextBlock.Document.SetText(TextSetOptions.FormatRtf,text);
richTextBlock.Background = new SolidColorBrush(Windows.UI.Colors.White);
richTextBlock.Padding = new Thickness(20,20,20,20);
printDoc.AddPage(richTextBlock);

//表示已提供所有打印页面
printDoc.AddPagesComplete();




但是这只是第一页,我该如何添加更多?我找不到一种方法来完成丰富的编辑框的全文,所有的帮助表示赞赏。


 

解决方案


好吧,我对"这只是第一页,我该如何添加更多?"感到困惑。我建议您可以将所有文本分成几个部分,然后创建几个TextBlock,然后使用  printDoc.AddPage()来添加它。 或者也许
您可以尝试将richtextblock放入真实页面并将页面添加到PrintDocument。


祝你好运,


罗伊


I have searched all over the internet and I have not found good documentation, I have seen others complain that it is complicated but I don't have any idea where to start other then having a richeditbox and button which will print the text in the richeditbox, if anyone has experience with this it would be very helpful for my work and for many others too.

Thank You.

Edit, now I got code to do a rich edit box

Text1.Document.GetText(TextGetOptions.UseCrlf, out var value);
            string text = value; ;
            RichEditBox richTextBlock = new RichEditBox();
            richTextBlock.Document.SetText(TextSetOptions.FormatRtf, text);
            richTextBlock.Background = new SolidColorBrush(Windows.UI.Colors.White);
            richTextBlock.Padding = new Thickness(20, 20, 20, 20);
            printDoc.AddPage(richTextBlock);

            // Indicate that all of the print pages have been provided
            printDoc.AddPagesComplete();


but this only does the first page, how do I add more? I cannot find a way to do the full text of the rich edit box, all help is appreciated.

 

解决方案

Hi,

Well, I'm little confused about "this only does the first page, how do I add more?". I suggest that you could divided all the text into several parts, then create several TextBlock and then use printDoc.AddPage() to add it.  Or maybe you could try to put the richtextblock in a real page and add the page to the PrintDocument.

Best regards,

Roy


这篇关于[UWP]从c#中的richeditbox打印的最佳方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆