WPF RichTextBox输出到RTF/水晶 [英] WPF RichTextBox output to RTF / Crystal

查看:76
本文介绍了WPF RichTextBox输出到RTF/水晶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨ppl

这是我第一次尝试使用Richtextbox组件,必须说它的效果很好.我唯一的问题是,我正在使用RTF格式将RichTextBox的内容保存在数据库中,以便随后可以使用Crystal Report进行打印.

This is my first try at the Richtextbox Component and must say that it works great. My only problem is that I am saving the contents of my richtextbox in a database using RTF format so that then I can print it using Crystal Report.

这是我用来从文本框中提取RTF格式的代码

This is the code I use to extract the RTF Format from my textbox

  TextRange文本=新的TextRange(rich1.Document.ContentStart,rich1.Document.ContentEnd);
 新的System.IO.MemoryStream myMem = new System.IO.MemoryStream();
  text.Save(myMem,DataFormats.Rtf);
 字符串sRetVal =  ASCIIEncoding.Default.GetString(myMem.ToArray());
 返回sRetVal;

  TextRange text = new TextRange(rich1.Document.ContentStart,rich1.Document.ContentEnd);
  new System.IO.MemoryStream  myMem = new System.IO.MemoryStream();
  text.Save(myMem, DataFormats.Rtf);
  string sRetVal =  ASCIIEncoding.Default.GetString(myMem.ToArray());
  return sRetVal;

这可以正常工作2.我的问题是,即使我将段落插入设置为rtf,即使我尝试在Crystal Report中打印此字段,所有行也会挤在一起.

This works fine 2. My problem is that if I try to print this field in a Crystal Report even if I set the paragraph interpration to rtf all lines come up crammed together.

 

任何人都有想法

推荐答案

伊万·萨姆穆特,

Hi Ivan Sammut,

 

欢迎来到MSDN论坛!

 

据我所知,您遇到使用Crystal Report打印的问题 WPF Richtextbox.

As far as I can see, you are encountering with a problem of Crystal Report printing using WPF Richtextbox.

 

但是我们不能根据您提供的说明,在我们这方面对您的问题进行复述.由于前两个步骤可以正常工作,因此问题可能出在 由格式转换或Crystal Report设置引起.您能详细说明一下您的问题吗?您可以向我们展示您的问题的屏幕快照.如果您能为您提供一个简单的可复制样本,我们将不胜感激. 我们进行调试.

However we could not repro your issue on our side based on the description you supplied. Since the first two steps work fine the problem may be caused by formatting conversion or Crystal Report setting. Could you please elaborate your issue? You may show us a screenshot of your problem. It would be appreciated if you could kindly offer a simple reproducible sample for us to debug with.

 

 

将为您提供帮助关于这个问题!

 

 

最好的问候,

Yves

 


这篇关于WPF RichTextBox输出到RTF/水晶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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