WPCubed Product Support

How to exclude images from saving?

wpsupport

You can the event BeforeSaveTextObjectand set the TextObject:=nil to not save some of the objects depending on certain contions.

procedure TForm1.DoBeforeSaveTextObject ( Writer : TWPCustomTextWriter;
    var TextObject : TWPTextObj) ;
begin
   if TextObject .IsImage then TextObject  := nil;
end;

in OnCreate:

WPRichText.RTFData.BeforeSaveTextObject  := DoBeforeSaveTextObject ;
#3 ♥ 1
1.7k Views 2 users 1 ♥ read 1 min

I see that RTFDataCollection.WriteObjectMode and wobDontSaveImages is only considered for RTF files in WPIOWriteRTF.pas and have no effect for any other format, am I correct?

#2 ♥ 0

I don't want images (TWPTextObj with wpobjImage as TWPTextObjType) to be saved when using SaveToStream. I'm using WPTOOLS format and have tried setting WP.WriteObjectMode to wobDontSaveImages , wobRTFNoBinary and wobStandardNoBinary . But images are still being saved.

How can I exclude images from being saved?

#1 ✎ ♥ 0