Table cell Bg image filename please

General TRichView support forum. Please post your questions here
Post Reply
vega
Posts: 50
Joined: Fri Oct 26, 2007 6:29 am

Table cell Bg image filename please

Post 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
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Are you sure that this property is not empty? (and autogenerated image file name is not used?)
vega
Posts: 50
Joined: Fri Oct 26, 2007 6:29 am

Post 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
Sergey Tkachenko
Site Admin
Posts: 17566
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
vega
Posts: 50
Joined: Fri Oct 26, 2007 6:29 am

Post by vega »

DONE !

Thanks for your patience Serguey
Post Reply