Page 1 of 1
rtf images
Posted: Mon Dec 28, 2009 12:25 pm
by shmuly
When I have an rtf with an image embedded in it, Stimulsoft has a very hard time processing it. It takes an extremely long time to create the report and usually causes the report to crash.
rtf images
Posted: Tue Dec 29, 2009 3:08 am
by Edward
Hi
Did you include that Rtf with images as a part of the report template in mrt file? If yes, then the Rtf text was serialized and stored as part of the .Net class in the report code.
.Net Framework has a limitation on the size of the report class.
So in that case you need to load rtf text in runtime from database or from text file.
In the GetValueEvent event of the RichText component please write the following code:
C#
System.IO.StreamReader reader = new System.IO.StreamReader("d:\\script.rtf");
string str = reader.ReadToEnd();
reader.Close();
e.Value = System.Xml.XmlConvert.EncodeName(StiRichText.PackRtf(str)
VB
Dim Reader As System.IO.StreamReader = New System.IO.StreamReader("d:\\script.rtf")
Dim Str As String = Reader.ReadToEnd()
Reader.Close()
e.Value = System.Xml.XmlConvert.EncodeName(StiRichText.PackRtf(Str))
Or alternatively you can load rtf text from database. The DataColumn property in RichText component can be used for this.
Thank you.
rtf images
Posted: Wed Dec 30, 2009 1:01 pm
by shmuly
Sorry for not giving more details in the original post.
The value of the RichTextBox is actually coming from a field in my data source.
FYI, I am applying some formatting to the RTF Box since it has trouble with interperting the horizontal alignment specified in the RTF.
Here is the code:
Code: Select all
Dim box1 As New Stimulsoft.Report.Controls.StiRichTextBox(True)
box1.Rtf = FlatTable.[Ad Text]
box1.SelectionStart = 0
box1.SelectionLength = box1.TextLength
box1.SelectionAlignment = Stimulsoft.Report.Controls.StiRtfSelectionAlign.Center
e.Value = System.Xml.XmlConvert.EncodeName(StiRichText.PackRtf(box1.Rtf))
box1.Dispose
rtf images
Posted: Wed Dec 30, 2009 3:41 pm
by Edward
Hi
Could you please send us a report template and that rtf text which causes the problems to support[at]stimulsoft.com?
Thank you.