I need to collect the table cells Background image filename & path. In the code below, FileName := TRVTableCellData(RVData.GetSourceRVData).BackgroundImageFileName; always returns '' (empty filename).
procedure T_FrmRicardoCSS.RichViewEdit1HTMLSaveImage(Sender: TCustomRichView;
RVData: TCustomRVData; ItemNo: Integer; const Path: String;
BackgroundColor: TColor; var Location: String; var DoDefault: Boolean);
var FileName: String; // i: integer;
begin
// what follows does not work. It is supposed to return the BACKGROUND IMAGE filename
if (ItemNo=-1) and (RVData.GetSourceRVData is TRVTableCellData) then begin
FileName := TRVTableCellData(RVData.GetSourceRVData).BackgroundImageFileName;
DoDefault := False;
end;
end;
Thanks in advance,
PS: If it can help, I should mention that I save HTML to stream as follows :
Sergey Tkachenko wrote:Are you sure that this property is not empty? (and autogenerated image file name is not used?)
First part of question : I am not sure about the property you're talking about, but there is a BG image in the cell for sure. BG images display fine in the RVE but I cannot catch their filename at HTML generation time.
Second part : when expoting to HTML, an image is written in the active dir (e.g.: 11.jpg). so "autogenerated image file name" may be used. How do I turn that off?
By default, all pictures exported with HTML are saved in files with autogenerated names.
If you include rvsoUseItemImageFileNames in Options parameters of SaveHTML/SaveHTMLEx, images having defined names are not saved, but their location is written in HTML file.
You have 3 options for images (including background images for cell):
1) to specify their location of their file in item/cell properties;
2) to save using autogenerated file names;
3) to customize saving using OnHTMLSaveImage or OnSaveImage2 events.
In order to use option #1, image file name must be defined. You need to assign this property yourself, or change the following properties to make it assigned:
- when reading RTF, image file names are assigned if TCustomRichView.RTFReadProperties.StoreImagesFileNames=True (only for external pictures inserted in RTF; and RTF does not support background cell pictures)
- when using RichViewActions, assign True to StoreFileName properties of the following actions: TrvActionInsertPicture, TrvActionPasteSpecial, TrvActionItemProperties, TrvActionTableProperties;
- TRVHTMLImporter always assign file names of pictures.