Version 4.25 delete all images

  • Hello

    I wish to strip all the images out of all the Blob fields that contains RTF code saved from a TDBWPRichText, but the examples that I can find all relate to version 5 or later. I am using Delphi 7 for this legacy app.

    So far I can select an image, but I can't delete it...
    for i := 0 to wpDB1.TextObjects.Count - 1 do
    begin
    if wpDB1.TextObjects.list[i] is TWPOImage then
    begin
    wpDB1.SetFocus;
    wpDB1.Changing;
    wpDB1.TextObjects.list[i].Select(True);
    wpDB1.InputString(#127); <--- doesn't delete the image
    end;
    if dataset in blah blah...
    Table1.Post;
    Table1.Next;

    Any assistance you could provide would be greatly appreciated.

    Regards & TIA

    • Offizieller Beitrag

    Did I send you this code a e-mail?

    Code
    WPRichText1.Memo.TxtObjLst.DeleteObjectsASAP := true;
      WPRichText1.Memo.TxtObjLst.ClearUsedFlags;
      for i:= WPRichText1.Memo.TxtObjLst.Count-1 downto 1 do
         if WPRichText1.Memo.TxtObjLst.GetData(i).obj=nil then
            include(WPRichText1.Memo.TxtObjLst.Item[i].flags, wplUsed);
       WPRichText1.Memo.TxtObjLst.DeleteUnused;