JVCL Help:BitmapToRTF

From Project JEDI Wiki
Jump to navigationJump to search
JEDI Visual Component Library Help

Search in JVCL Help

 
Search in all projects
 

Summary

Converts a bitmap to rich text format.

run\JvRichEdit.pas


Pascal

 run\JvRichEdit.pas
 procedureBitmapToRTF(ABitmap: TBitmap; AStream: TStream);
functionBitmapToRTF2(ABitmap: TBitmap; AStream: TStream): Boolean;


Parameters

Parameters Description
ABitmap: TBitmap The bitmap to convert.
AStream: TStream Stream where to save the RTF data to.

run\JvRichEdit.pas


Description

Use the BitmapToRTF or BitmapToRTF2 procedures to insert bitmaps in a rich edit control. BitmapToRTF2 returns true if the bitmap is written to stream as RTF, or false if an error occurred.
For example, to replace the selected text with a bitmap, do the following: Stream := TMemoryStream.Create;

   try
BitmapToRTF(SomeBitmap, Stream);
Stream.Position := 0;


     JvRichEdit1.StreamFormat := sfRichText;
JvRichEdit1.StreamMode := [smSelection, smPlainRtf];
JvRichEdit1.Lines.LoadFromStream(Stream);
finally
Stream.Free;
end;

  • If you stream out the RTF content of the rich edit control, the bitmaps are not included. Use InsertGraphic if you want the bitmaps to be includedin the streamed out RTF data.
  • TJvRichEdit.AllowObjects must be set to true.
  • BitmapToRTF is the fastest, InsertGraphic the slowest.

run\JvRichEdit.pas


See Also

TJvRichEdit, TJvCustomRichEdit.InsertGraphic

run\JvRichEdit.pas


About

Contribute to this help topic

This documentation wiki is based on the collaborative effort of Project JEDI users. Your edits are welcome in order to improve documentation quality: edit this page