views:

1137

answers:

2

I have crystal report and I need to convert it to text file. Currently I can only convert it to RTF Stream. Now I need to convert the RTF Stream to Text Stream. I am using C#.

Thanks.

+2  A: 

Correct me if I am wrong but you are using the ExportToStream method with ExportFormatType.RichText:

Stream stream = report.ExportToStream(ExportFormatType.RichText);

This exports the report into an RTF stream. Now you wish to convert this stream to plain text (extract the text from the RTF). If that's true then this thread might have the answer for you.

Darin Dimitrov
A: 

Thanks I am using the ExportToStream to convert I used something like this: RichTextBox rtBox = new RichTextBox(); UTF8Encoding encoder = new UTF8Encoding(); rtBox.Rtf = encoder.GetString(rtf); return new MemoryStream(Encoding.UTF8.GetBytes(rtBox.Text));

But there are some parts of the report that are interchanged maybe am I using the correct encoding by Crystal Reports?

Thanks