IE / Firefox -> Clipboard -> TRichView

General TRichView support forum. Please post your questions here
Post Reply
cmcnutt
Posts: 2
Joined: Wed Mar 22, 2006 10:31 am

IE / Firefox -> Clipboard -> TRichView

Post by cmcnutt »

Sergey -

Thanks for your excellent component, your attentiveness to my installation issues, AND for setting up this user forum -- this will help answer many of my (our) questions without having to distract you from programming future TRichView features and versions! : ) Yea!!



My main objective with TRichView right now is to store "rich text / image" snippets in a database table (currently using Access 2000 via ADO). The majority of these "snippets" will come via copy-and-paste from web pages (Firefox usually, but IE as well sometimes). It seems a number of posts touch on this set of problems (i.e. it's not just me looking for this info), but I can't seem to find the definitiive "how to" answers I'm looking for here or in the demo project(s). (There are some fabulous demos there though! -- thanks for those!!).

I want to be able to copy a web page or part of a web page, paste it in a data-bound "rich text" control, and save that WITH the images included into that databaae field / table. I don't care what format I save the data in (RTF / HTML / text / blob --- whatever), as long as the layout is preserved fairly well, and I can export to various formats as needed (HTML, RTF, maybe Word / Doc, etc). I'm thinking that would mean my best approach w/b to store in native TRichView format, to a blob/OLE field, but I am not sure. Which is best?


What I've found in my previous experiments with this, adopting the TActions demo project as a trial run, led to inconsistent results -- i.e. sometimes pictures would come across, and sometimes they wouldn't.

Any suggestions / guidance on this w/b appreciated... but specifically:

1) What format to save to in the DB
2) What additional components s/b needed (HTML import, for example)
3) How to anticipate and accomodate the Clipboard's format
4) How to "import" and save (in the database) the pictures that may, in the HTML, just be links / path references.
5) Special caveats / property settings to watch for on the TRichView control.


Thanks for any and all help! : )
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

I am not sure how FireFox copies to the Clipboard, IE copies them in several formats, including RTF and HTML.
RTF usually copied unreliable, sometimes IE even copy empty RTF.
So it's better to copy in HTML format, using RvHtmlImporter.

If you copy in TRichViewEdit, use this code:

Code: Select all

if DBRVE.CanChange then begin
  RvHtmlImporter.LoadFromClipboard;
  DBRVE.Change;
  DBRVE.Format;
end;
f you want to save changed in the database immediately, call Table.Post instead of DBRVE.Format.

It's usually better to save data in RVF format in DB (it's a default setting).

Local pictures will be loaded in RvHtmlImporter automatically.
Remote pictures should be downloaded. For example, this demo uses Indy to download: http://www.trichview.com/resources/html/rvhtml_indy.zip
RVHtmlImporter saves paths to pictures in rvespImageFileName property (see TRVExtraItemStrProperty type)
cmcnutt
Posts: 2
Joined: Wed Mar 22, 2006 10:31 am

Post by cmcnutt »

Thanks Sergey -- very much appreicated! I'll give all these things a try.
Post Reply