Page 1 of 1

TRichviewEdit: Unable to read exported rtf files/streams

Posted: Mon Mar 17, 2008 3:18 pm
by Mafi
I'm using the TRichview 1.9.48, D5 and have some problems in reading *.rtf files/streams via the methods LoadRTF and LoadRTFFromStream (reports an exception: "invalid bitmap" in file rvrtf.pas, line 3149, "LoadGraphic(gr);").

All rtf-files and -streams are generated via the RvHtmlImporter component (converting user generated HTML-emails to rtf) and the methods SaveRTF and SaveRTFToStream of the TRichviewEdit component, but for some of them, the output is no more readable for the TRichviewEdit component. The directly converted document will be displayed in the corresp. TRichviewEdit (which is directly linked to the RvHtmlImporter) and looks ok.

All components have no special property settings.

Please can I attach a generated *.rtf anywhere to this message, so it's easier for you to reproduce the error.


Thanks
Mafi

Posted: Mon Mar 17, 2008 6:55 pm
by Sergey Tkachenko
Please send them to [email protected]

Posted: Tue Mar 18, 2008 10:02 am
by Sergey Tkachenko
I received this file.
The problem is caused by a zero-size bitmap:
{\pict\dibitmap0\wbmwidthbytes0\picw0\pich0\picwgoal0\pichgoal0 }

Fix: open RVRTF.pas, find the procedure LoadGraphic(var gr: TGraphic), add in case:

Code: Select all

        rtf_pict_DIB:
          if FPicture.FData.Size>sizeof(TBitmapFileHeader) then begin
            FPicture.FData.Position := 0;
            gr.LoadFromStream(FPicture.FData);
          end;