trichview.support
Re: InsertRTF |
Author |
Message |
CC |
Posted: 01/28/2005 12:13:30 Hi, But I don't know why it can be displayed by Rich Edit. I have some code below (just test RTF including bitmaps). Is there something wrong? {---------------------------------} procedure Insert(a : TBitmap); function BitmapToRTF(pict: Graphics.TBitmap): string; //--from Google (ExRichEdit) :-) var bi, bb, rtf: string; bis, bbs: Cardinal; achar: ShortString; hexpict: string; i: Integer; begin GetDIBSizes(pict.Handle, bis, bbs); SetLength(bi,bis); SetLength(bb,bbs); GetDIB(pict.Handle, pict.Palette, PChar(bi)^, PChar(bb)^); rtf := '{\rtf1 {\pict\dibitmap '; SetLength(hexpict,(Length(bb) + Length(bi)) * 2); i := 2; for bis := 1 to Length(bi) do begin achar := Format('%x',[Integer(bi[bis])]); if Length(achar) = 1 then achar := '0' + achar; hexpict[i-1] := achar[1]; hexpict[i] := achar[2]; inc(i,2); end; for bbs := 1 to Length(bb) do begin achar := Format('%x',[Integer(bb[bbs])]); if Length(achar) = 1 then achar := '0' + achar; hexpict[i-1] := achar[1]; hexpict[i] := achar[2]; inc(i,2); end; rtf := rtf + hexpict + ' }}'; Result := rtf; end; var str : TStringStream; begin str := TStringStream.Create(BitmapToRTF(a)); rv.ReadOnly := false; rv.InsertRTFFromStreamEd(str); str.Free(); rv.Format; end; {------------------------------} Thanks and Regards, C.C "Sergey Tkachenko" <[email protected]> wrote in message news:[email protected]... > \dibitmap is supported by TRichView (if you do not use some old version). > Please send me RTF file which cannot be loaded. > > >> Hi, >> I want to show a bitmap from RTF file into RichViewEdit. >> But it can't display the bitmap if RTF file is '\rtf1 {\pict\dibitmap > ...' >> . >> It just works with '{rtf1 >> {\pict\wmetafile8\picw423\pich423\picwgoal240\pichgoal240 ...'. >> RichEdit is working with both. >> Please help me. >> >> Best regards, >> C.C >> >> > > |
Powered by ABC Amber Outlook Express Converter