specific the image name in savehtml

General TRichView support forum. Please post your questions here
Post Reply
noibird
Posts: 10
Joined: Thu Feb 24, 2011 5:14 pm

specific the image name in savehtml

Post by noibird »

Hi,

I want to use savehtml(or savestream), and I need to specific the image name. But I found savehtml only can save the image with a name:prefix+num.

Is there any way to save the image with a specific name?

Any help is appericate.
Sergey Tkachenko
Site Admin
Posts: 17291
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

You can specify the image file name in the item properties.
See rvespImageFileName in http://www.trichview.com/help/idh_type_ ... perty.html
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 (paths will be converted to relative paths).

If you need something different, you can use OnHTMLSaveImage or OnSaveImage2 events.
noibird
Posts: 10
Joined: Thu Feb 24, 2011 5:14 pm

Post by noibird »

Thanks!
I've add rvsoUseItemImageFileNames to Options parameter of SaveHTML, but in HTML the images' name are also prex+num. I specific the images' name like this: rve->InsertPicture("name", gr, rvvaBaseline). Is it right way to specific the image's name?

I search the whol forum, I coudn't find a sample code for OnSaveImage2 event to help me fix this problem. Is there a sample for it?

Any help is appericate.
noibird
Posts: 10
Joined: Thu Feb 24, 2011 5:14 pm

Post by noibird »

help.......................
Sergey Tkachenko
Site Admin
Posts: 17291
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The first parameter of InsertPicture is an "item name", it is not used by the component itself. rvespImageFileName is assigned differently.
To make insertion and assigning this property a single operation, undo records must be grouped.

Code: Select all

rve->TopLevelEditor->BeginUndoGroup(rvutInsert);
rve->TopLevelEditor->SetUndoGroupMode(true);
if (rve->InsertPicture("name", gr, rvvaBaseline))
  rve->SetCurrentItemExtraStrProperty(rvespImageFileName, ImageFileName, true);
rve->TopLevelEditor->SetUndoGroupMode(false);
noibird
Posts: 10
Joined: Thu Feb 24, 2011 5:14 pm

Post by noibird »

Thank you very much :D
Post Reply