Don't save picture

General TRichView support forum. Please post your questions here
Post Reply
remixtech
Posts: 49
Joined: Mon Jun 18, 2007 3:53 pm

Don't save picture

Post by remixtech »

Hello,

I would like to save an html without picture, just recover htmltext, actually i use :

Code: Select all

 
HTMLSaveOptions := [rvsoImageSizes, rvsoUseCheckpointsNames];
editeur.SaveHTMLToStreamEx(memoire,'', 'I-Mail HTML Editor', '', '','', '',htmlsaveoptions);
I haven't seen this option ?

Is it possible?
Thanks
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Process OnSaveItemToFile event:

Code: Select all

uses CRVData;

procedure TForm1.RichViewEdit1SaveItemToFile(Sender: TCustomRichView;
  const Path: String; RVData: TCustomRVData; ItemNo: Integer;
  SaveFormat: TRVSaveFormat; Unicode: Boolean; var OutStr: String;
  var DoDefault: Boolean);
var StyleNo: Integer;
begin
  if (SaveFormat=rvsfHTML) then begin
    StyleNo := RVData.GetItemStyle(ItemNo);
    if (StyleNo=rvsPicture) or (StyleNo=rvsHotPicture) or
       (StyleNo=rvsBullet) or (StyleNo=rvsHotspot) then begin
      OutStr := '';
      DoDefault := False;
    end;
  end;
end;
After this change, the main picture item types will not be saved in HTML. To prevent saving other pictures (for example, table background picture), process also SaveImage2 event:

Code: Select all

procedure TForm1.RichViewEdit1SaveImage2(Sender: TCustomRichView;
  Graphic: TGraphic; SaveFormat: TRVSaveFormat; const Path,
  ImagePrefix: String; var ImageSaveNo: Integer; var Location: String;
  var DoDefault: Boolean);
begin
  if SaveFormat=rvsfHTML then begin
    Location := '';
    DoDefault := False;
  end;
end;
remixtech
Posts: 49
Joined: Mon Jun 18, 2007 3:53 pm

Post by remixtech »

Hello, thanks a lot but i want to keep the url of the picture...
If i had the picture

http://www.fond-ecran-image.com/galerie ... e,moon.jpg

I want to keep in the saved file the url : http://www.fond-ecran-image.com/galerie ... e,moon.jpg

Thanks, sorry if you don't understand i'am not speaking english very well...
Bye
Sergey Tkachenko
Site Admin
Posts: 17564
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

The simplest way to do it is to store image location in rvespImageFileName item property. If you include rvsoUseItemImageFileNames in Options parameter of SaveHTML/SaveHTMLEx, value of this property will be written in <img src>.

How to set this property?
  • When generating documents, use SetItemExtraStrProperty.
  • When editing, use SetCurrentItemExtraStrProperty.
  • When reading RTF, set RichView.RTFReadProperties.StoreImagesFileNames = True (of course, it affects only external images, not images embedded in RTF).
  • RvHtmlImporter always assigns this property for imported images.
  • In RichViewActions, TrvActionInsertPicture assigns this property for inserted images if rvActionInsertPicture.StoreFileName=True (starting from RichViewActions v1.53)
Post Reply