Hi I am dealing with rich text box print preview. The problem is I am stuck at the way to embed the rich text box inside Report object.
Basically I wanted to use XamReportPreview.GeneratePreview(Report) method to show the to-be-printed rich text box including all the font and size attributes.The code I used is following
RichTextBox rtb = new RichTextBox(); // Create a FlowDocument FlowDocument mcFlowDoc = new FlowDocument(); // Create a paragraph with text Paragraph para = new Paragraph(); para.Inlines.Add(text); // Add the paragraph to blocks of paragraph mcFlowDoc.Blocks.Add(para); rtb.Document = mcFlowDoc; rtb.Width = 600; rtb.Height = 800;
at this point I created a RichTextBox object and "text" is the actual rtf passed over from somewhere else. Then,
EmbeddedVisualReportSection section = new EmbeddedVisualReportSection(rtb); previewedContent.Sections.Add(section);
I embedded this rtb into a Report object called previewedContent. When I tried to preview this report, the rich text attributes cannot be interpreted. How can I convert the text into the rtf?
Thanks
this issue has been resolved, we can use memory stream to load rtf info. see this link for more info:
http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/308c5712-028a-461e-982e-d03c0f228210/