trichview.com

trichview.support




Re: Source of Images


Return to index


Author

Message

Sergey Tkachenko

Posted: 11/17/2003 20:19:02


1) You need to store the source image file name.


Images can be in:

a) image item types (rvsPicture, rvsHotPicture)

b) document background bitmap

c) background for table

d) background for table cells

e) imagelist images (rvsBullet, rvsHotspot)

f) images in paragraph lists


For (a) and (c) you can store image file name in the text associated with

the item (the first parameter of Insert*** method, can be changed with

SetItemText)

For (b) you can store image file name elsewhere in your applications (for

example, in RichViewEdit.DocProperties)

(e) will not appear in your application (if you will not add a special

support for them, but it's not needed in HTML editor)

Storing the source (d) and (f) is the most problematic.

If you plan to use RichViewActions, they directly support saving image file

names only for (a). You need to set TrvActionInsertPicture.StoreFileName =

True. And (a) is the most important case.

If you do not use RichViewActions, just insert pictures like this:

rve.InsertPicture('\images\test.jpg', jpeg);


2) You need to process an event for saving images.

Note: images can be not only inserted from the hard drive, but also pasted

from the Clipboard or inserted with RTF. In such case they do not have the

associated file names (but you may provide for user a possibility to enter

them).

The code below (for OnSaveHTMLImage event) override the default processing

only for images with the defined file names:


procedure TForm3.RichViewEdit1HTMLSaveImage(Sender: TCustomRichView;

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

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

var s: String;

begin

  if (ItemNo>=0) and

     ((RVData.GetItemStyle(ItemNo)=rvsPicture) or

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

    s := RVData.GetItemText(ItemNo);

    if s<>'' then begin

      Location := ExtractRelativePath(Path, s);

      DoDefault := False;

    end;

  end;

end;





> Hi,

>

> i want to use TRichView as HTML-Editor in my Aplication.

> How can i import Images and set the images-source and

> export as html without creating a new image. Instead i want

> to save the original source or the external source.

>

> Best Regards

> Johannes Teitge

>

>





Powered by ABC Amber Outlook Express Converter