Hi,
my businessobject has text-properties of type FlowDocument (can be converted to rtf).
Is it possible to use the formatted FlowDocument for report-creation?
Best Regards
How to use FlowDucument-property
How to use FlowDucument-property
Hello,
We have added new static method which can help you load FlowDocument to richtext. New method will be available in prerelease build from 26 April. Please use following code for GetValueEvent of richtext component:
You need add reference to Stimulsoft.Report.Wpf.dll in ReferencedAssemblies property of report. You can do this in report designer. Also you can implement method ConvertFlowDocumentToRtf in report code. Here is source code of this method:
Thank you.
We have added new static method which can help you load FlowDocument to richtext. New method will be available in prerelease build from 26 April. Please use following code for GetValueEvent of richtext component:
Code: Select all
System.IO.Stream stream = new System.IO.FileStream("d:\\test.xaml", System.IO.FileMode.Open);
string str = Stimulsoft.Report.Wpf.StiRtfHelper.ConvertFlowDocumentToRtf(stream);
e.Value = System.Xml.XmlConvert.EncodeName(StiRichText.PackRtf(str));
Code: Select all
public static string ConvertFlowDocumentToRtf(Stream stream)
{
RichTextBox richTextBox = new RichTextBox();
TextRange documentTextRange = new TextRange(richTextBox.Document.ContentStart, richTextBox.Document.ContentEnd);
documentTextRange.Load(stream, DataFormats.Xaml);
MemoryStream tempStream = new MemoryStream();
documentTextRange.Save(tempStream, DataFormats.Rtf);
return System.Text.Encoding.Default.GetString(tempStream.GetBuffer());
}
How to use FlowDucument-property
Thank you!
I'll try that.
Best Regards
I'll try that.
Best Regards
How to use FlowDucument-property
Hello,
Let us know about the result.
Thank you.
Let us know about the result.
Thank you.
How to use FlowDucument-property
Hi,
I tested it and it works without any problems!
I let my businessobject do the converting, so I dont have to add references in the designer.
Best Regards
Steffen
I tested it and it works without any problems!
I let my businessobject do the converting, so I dont have to add references in the designer.
Best Regards
Steffen
How to use FlowDucument-property
Hello Steffen,
Glad to help you.
Thank you.
Glad to help you.
Thank you.