In the document there is a lot of text and small images.
Now, when user selects the text with the images for copy to clipboard images are ignored ( I use CopyText() method).
Now I would like to make the copying better and copy text with images like that
text text text <image Name> text text text
I use AddPictureEx with Name value that I want to be visible after copy.
Unfortunately, the current TRichView version does not allow this.
You can use a low level event OnSaveComponentToFile to modify how images are saved in text, but it will not affect methods for copying or saving selection, only methods for saving the complete text:
uses CRVData, RVUni;
procedure TForm1.RichViewEdit1SaveItemToFile(Sender: TCustomRichView;
const Path: String; RVData: TCustomRVData; ItemNo: Integer;
SaveFormat: TRVSaveFormat; Unicode: Boolean;
var OutStr: TRVRawByteString; var DoDefault: Boolean);
var s: String;
begin
if (SaveFormat<>rvsfText) then
exit;
if (RVData.GetItemStyle(ItemNo)<>rvsPicture) and
(RVData.GetItemStyle(ItemNo)<>rvsHotPicture) then
exit;
RVData.GetItemExtraStrProperty(ItemNo, rvespAlt, s);
if s='' then
s := 'image';
s := '<'+s+'>';
DoDefault := False;
// for Delphi 4-2007
if Unicode then
OutStr := RVU_AnsiToUnicode(RVData.GetRVStyle.DefCodePage, s)
else
OutStr := s;
{
// for Delphi 2009
if not Unicode then
OutStr := RVU_UnicodeToAnsi(RVData.GetRVStyle.DefCodePage, RVU_GetRawUnicode(s))
else
OutStr := RVU_GetRawUnicode(s);
}
end;