rtf images

Stimulsoft Reports.NET discussion
Post Reply
shmuly
Posts: 58
Joined: Wed Jul 05, 2006 2:19 pm

rtf images

Post 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.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

rtf images

Post 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.
shmuly
Posts: 58
Joined: Wed Jul 05, 2006 2:19 pm

rtf images

Post 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
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

rtf images

Post 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.
Post Reply