Hi~
First, Excuse me for my poor English.
I tried to drag Texts+Images from Internet Explorer(IE) and drop its to TRichviewEdit(RVE), but dropped only Texts to RVE.
Resultly, Texts or Images dropped to RVE only one at time.
How can I drag&drop Texts+Images to RVE at once?
Is it possible?
Text and Image Drag&Drop...
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Text and Image Drag&Drop...
If you drop a single image, IE provides it as a reference to a file (in its cache), so TRichView can easily read it.
If you drop a page fragment containing text and pictures, IE provides it as plain text, RTF, and HTML. By default, TRichViewEdit reads it as RTF.
This RTF contains references to picture URLs. TRichView cannot download it itself, you need to help it.
If you use RichViewActions, it's more simple. If you assign RVAControlPanel.DownloadInterface, RichViewActons download external images when you load, insert and paste files. However, to download them on drag&drop, you need to add code in OnBeforeOleDrop and OnAfterOleDrop, see http://www.trichview.com/help/idh_trich ... edrop.html
If you drop a page fragment containing text and pictures, IE provides it as plain text, RTF, and HTML. By default, TRichViewEdit reads it as RTF.
This RTF contains references to picture URLs. TRichView cannot download it itself, you need to help it.
If you use RichViewActions, it's more simple. If you assign RVAControlPanel.DownloadInterface, RichViewActons download external images when you load, insert and paste files. However, to download them on drag&drop, you need to add code in OnBeforeOleDrop and OnAfterOleDrop, see http://www.trichview.com/help/idh_trich ... edrop.html
-
- Posts: 7
- Joined: Wed Nov 01, 2017 11:13 am
Re: Text and Image Drag&Drop...
Very Late, I see your kindly answer...
I did the test as you answered, but it doesn't work the way I want it to.
Text is dropping but images aren't downloaded.
I've looked at this document...
http://www.trichview.com/forums/viewtop ... ace#p31614
I tested using RVControlPanel, DownloadInterface and IndyHTTP. but it doesn't work like it should.
I set properties...
- rvControlPanel.DefaultControl := rve;
- rvControlPanel.DownloadInterface := rvDownloadInterface;
- rvDownloadInterface.IdHttp := IndyHttp;
It's my source code below...
And I try drop&drop to rve from Texts&Pictures in IE, but it doesn't work...
I don't know why rvControlPanel.DoImportPicture doesn't do anything.
Help me plz...
I did the test as you answered, but it doesn't work the way I want it to.
Text is dropping but images aren't downloaded.
I've looked at this document...
http://www.trichview.com/forums/viewtop ... ace#p31614
I tested using RVControlPanel, DownloadInterface and IndyHTTP. but it doesn't work like it should.
I set properties...
- rvControlPanel.DefaultControl := rve;
- rvControlPanel.DownloadInterface := rvDownloadInterface;
- rvDownloadInterface.IdHttp := IndyHttp;
It's my source code below...
Code: Select all
procedure TMyForm.rveBeforeOleDrop(Sender: TObject);
begin
rvControlPanel.InitImportPictures(nil, nil);
(Sender as TCustomRichViewEdit).OnImportPicture := rvControlPanel.DoImportPicture;
end;
procedure TMyForm.rveAfterOleDrop(Sender: TObject);
var
W, X: Integer;
begin
(Sender as TCustomRichViewEdit).OnImportPicture := nil;
rvControlPanel.DoneImportPictures;
end;
I don't know why rvControlPanel.DoImportPicture doesn't do anything.
Help me plz...
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Text and Image Drag&Drop...
From which page do you drag?
-
- Posts: 7
- Joined: Wed Nov 01, 2017 11:13 am
Re: Text and Image Drag&Drop...
I scrap text & image from IE and drag & drop to rve.
For example...
https://www.nytimes.com/2017/11/11/wor ... e=article
The below picture is the result of rve.
For example...
https://www.nytimes.com/2017/11/11/wor ... e=article
The below picture is the result of rve.
-
- Posts: 7
- Joined: Wed Nov 01, 2017 11:13 am
Re: Text and Image Drag&Drop...
May I have an answer to this?
-
- Site Admin
- Posts: 17559
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Text and Image Drag&Drop...
I tested, it works as expected. I attached a sample project.
Important note 1: it works only when dragging from Internet Explorer, because it provides RTF format when copying or dragging.
It does not work when dragging from other browsers (including Edge, FireFox and Chrome), because they do not provide RTF, so their content is inserted in TRichViewEdit as a plain text.
Important note 2: Internet Explorer does not provide RTF for "too complex" content, that includes many nested tables. So, if it does not work, try dragging a smaller fragment.
The problems above could be solved by using HTML format instead of RTF: all major browsers provide content as HTML.
For pasting, it's simple to do, especially using RichViewActions: assign TrvHtmlImporter, or (better) TrvHtmlViewImporter to RVAControlPanel.HTMLComponent.
For drag&drop, it's more difficult, it requires writing quite low-level code in OnOle*** events. Probably, in future versions, I'll simplify it.
Important note 1: it works only when dragging from Internet Explorer, because it provides RTF format when copying or dragging.
It does not work when dragging from other browsers (including Edge, FireFox and Chrome), because they do not provide RTF, so their content is inserted in TRichViewEdit as a plain text.
Important note 2: Internet Explorer does not provide RTF for "too complex" content, that includes many nested tables. So, if it does not work, try dragging a smaller fragment.
The problems above could be solved by using HTML format instead of RTF: all major browsers provide content as HTML.
For pasting, it's simple to do, especially using RichViewActions: assign TrvHtmlImporter, or (better) TrvHtmlViewImporter to RVAControlPanel.HTMLComponent.
For drag&drop, it's more difficult, it requires writing quite low-level code in OnOle*** events. Probably, in future versions, I'll simplify it.
- Attachments
-
- DDPictures.zip
- (50.05 KiB) Downloaded 1305 times