trichview.com

trichview.support




Re: Inserting Images


Return to index


Author

Message

Sergey Tkachenko

Posted: 05/12/2003 17:47:16


Yes, names of images files are not stored in documents (and images can be

inserted not only from files, but from the Clipboard or they can be

constructed by the application itself).

When saving to RVF (native RichView format) or to RTF, images are stored

inside documents, so file names are not important. But when saving to HTML,

the component generates file names as img1.jpg, img2.jpg and so on (prefix

of file names is customizable)


But you can store file names in "image names" ("image name" is the first

parameter of InsertPicture(), it can be get/set by methods GetItemText() and

SetItemText())

The demo in Demos\Dephi\Assorted\Graphics\SharedImages\ may be useful for

understanding how it works.

This demo saves inserted images in folder IMAGES, and it stores image file

names in "image names". If some image was inserted from file, "image name"

is assigned immediately. If the image was pasted, its name is assigned

before saving (see the procedure SaveAllUnknownImages())


Ok, now we have images and their file names. As I understand, you need to

insert links to them in HTML instead of generating img1.jpg, img2.jpg, etc.


Use OnHTMLSaveImage event:


procedure TForm3.RichViewEdit1HTMLSaveImage(Sender: TCustomRichView;

  RVData: TCustomRVData; ItemNo: Integer; const Path: String;

  BackgroundColor: TColor; var Location: String; var DoDefault: Boolean);

begin

   if (ItemNo>=0) and (

    (RVData.GetItemStyle(ItemNo)=rvsPicture) or

    (RVData.GetItemStyle(ItemNo)=rvsHotPicture)) then begin

    Location := RVData.GetItemText(ItemNo);

    DoDefault := Location='';

  end;

end;




>

> Hello,

>

> we have a licenced copy of RichView and we are using Delphi to develop it.

>

> We are having the following issue:

>

> When we insert an image, or series of images, in the "body" of the text

the

> code replaces the original names of all of them to img1, img2, img3 ....

>

>

> The system asks me for the initials of the files, but that's not what I

want

> to happen. What I really need is to PRESERVE their original file names.

>

> How can I accomplish this ?

>

>

> Thank you,

>

> Monica.







Powered by ABC Amber Outlook Express Converter