Page 1 of 1
HTML-Export and Imagefilenames
Posted: Sun Aug 20, 2006 4:16 pm
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
Posted: Mon Aug 21, 2006 4:01 pm
by Yernar Shambayev
I guess you need to handle OnSaveImage2 event.
Posted: Mon Aug 21, 2006 4:18 pm
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
Posted: Mon Aug 21, 2006 4:19 pm
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.
Posted: Tue Aug 22, 2006 3:19 pm
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
Posted: Wed Aug 23, 2006 12:27 pm
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.
Posted: Wed Aug 23, 2006 12:37 pm
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
Posted: Thu Aug 24, 2006 11:38 am
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;