Page 1 of 1
Don't save picture
Posted: Fri Jun 22, 2007 1:43 pm
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
Posted: Sun Jun 24, 2007 8:16 am
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;
Posted: Sun Jun 24, 2007 1:26 pm
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
Posted: Sun Jun 24, 2007 3:26 pm
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)