HTML-Export and Imagefilenames

General TRichView support forum. Please post your questions here
Post Reply
Ralf
Posts: 4
Joined: Sun Aug 20, 2006 4:02 pm

HTML-Export and Imagefilenames

Post by Ralf »

Hi all,

if i use RichViewEdit1.SaveHTMLEx to create an HTML-File, all Images will be renamed to "img[n].gif".

What can i do to leave the original Filenames of the Images inside the created HTML-File (with or without Path-Information)?

Is there an easy way to do this?

Thanks and Regards from Germany
Ralf
Yernar Shambayev
Posts: 57
Joined: Wed Aug 31, 2005 6:46 pm

Post by Yernar Shambayev »

I guess you need to handle OnSaveImage2 event.
Ralf
Posts: 4
Joined: Sun Aug 20, 2006 4:02 pm

Post by Ralf »

Thank you for your Request ...

Please can you give me some Hints, how tu use "OnSaveImage2" ?
Where in my Code i have to do this?

Best Regards
Ralf
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Yes, you can save images in different files using OnSaveImage2 or OnHTMLSaveImage.
See also the help on "TRVExtraItemStrProperty type":

rvespImageFileName
Applicable to: pictures, hot-pictures, tables
Provides a place to store image file name (background image for table). For tables, this value is also accessible as table.
BackgroundImageFileName.
See also: TRVTableCellData.BackgroundImageFileName
If rvsoUseItemImageFileNames is included in the Options parameter of SaveHTML/SaveHTMLEx, images with defined (non-empty) file names will not be saved, but their file names will be written in HTML.
Ralf
Posts: 4
Joined: Sun Aug 20, 2006 4:02 pm

Post by Ralf »

Thanks for helping, but i dont understand anything.

In Demo-Application "Editor 1" i have added:
SetHTMLOption(cbHTMLUseItemImageFileNames.Checked, rvsoUseItemImageFileNames); an a checkbox similar to the option.

But inside the generated HTML-File Images still named img1, img2 ...

I dont need to save the Imagesfile. I only need, that the Filename and Path from the Image is stored in HTML-Code.

Please can you help me again ...!?

Thanks and Regards
Ralf
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It's because value of this property (rvespImageFileName) is empty for all images in this demo, and this demo does not allow to change this property.
Ralf
Posts: 4
Joined: Sun Aug 20, 2006 4:02 pm

Post by Ralf »

Great! :-(

But HOW and WHERE have i to implement the property rvespImageFileName ????

How many things i have to do to effect a simple an normal thing!??!?

Is there any sample for this?

I'm wondering why it is so difficult to have Imagenames inside the HTML-Code. Normally this is a "must have" ...

Regards
Ralf
Sergey Tkachenko
Site Admin
Posts: 17555
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Actually, it's simple.

Reading for the item (picture) at the position of caret:
rve.GetCurrentItemExtraStrProperty(rvespImageFileName, FileName).

Changing for the item (picture) at the position of caret
rve.SetCurrentItemExtraStrProperty(rvespImageFileName, FileName, True).

In the insert picture code, the following fragment should be changed

Code: Select all

      if gr<>nil then
        RichViewEdit1.InsertPicture('',gr,rvvaBaseLine);
to

Code: Select all

      if gr<>nil then begin
        RichViewEdit1.TopLevelEditor.BeginUndoGroup(rvutInsert); 
        RichViewEdit1.TopLevelEditor.SetUndoGroupMode(True); 
        try 
          if RichViewEdit1.InsertPicture('', gr, rvvaBaseline) then 
            RichViewEdit1.SetCurrentItemExtraStrProperty(
              rvespImageFileName, OpenDialog1.FileName, True); 
        finally 
          RichViewEdit1.TopLevelEditor.SetUndoGroupMode(False); 
        end; 
      end;
Post Reply