Page 1 of 1

Table cell Bg image filename please

Posted: Sat Jan 10, 2009 12:07 pm
by vega
I need to collect the table cells Background image filename & path. In the code below, FileName := TRVTableCellData(RVData.GetSourceRVData).BackgroundImageFileName; always returns '' (empty filename).

Please help. This is driving me insane.

Code: Select all

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 :

Code: Select all

RichViewEdit1.SaveHTMLToStreamEx(streamRVEHtml,'','','','','','',
    [rvsoMiddleOnly, rvsoUseItemImageFileNames, rvsoImageSizes,
    rvsoNoHypertextImageBorders, rvsoMarkersAsText, rvsoNoDefCSSStyle,
    rvsoInlineCSS]);

Dan

Posted: Sat Jan 10, 2009 3:07 pm
by Sergey Tkachenko
Are you sure that this property is not empty? (and autogenerated image file name is not used?)

Posted: Sat Jan 10, 2009 5:24 pm
by vega
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?

Thanks,

Dan

Posted: Sun Jan 11, 2009 3:04 pm
by Sergey Tkachenko
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.

Posted: Mon Jan 12, 2009 9:58 am
by vega
DONE !

Thanks for your patience Serguey