Images from mailmerge not positioning properly anymore

  • In 5.17.4, images that were marked as "position relative to paragraph" maintained their position even if brought into a WPRichtext via a mailmerge.

    However, since then (5.18.6 and even the brand new 5.18.7, maybe earlier versions too), those images get aligned at the beginning of the paragraph after the mailmerge.

    I had also used 5.18.3, but not sure if the problem was in that version or not... I can backtrack if you'd like me to.

    This is critical!!!! I wish I noticed this two weeks ago!

    • Offizieller Beitrag

    Something is special about application - something interferes with the concept that you have this and the keep problem.
    The mailmerge internally is based on LoadFromStream operations - there is no special code involved.

    What you should try out is the MergeOption mmDeleteThisField wwhich had been added in 5.17.3 - If you do not need a subsequent merge

    This helps for inserted tables, maybe also for images.

    It would be also interesting if you merge RTF or WPTOOLS texts and if the page size of the source is the same as the destination. The page size is important for image positioning.

    It would be good if you could together a demo which uses same texts and techniques as your apllication.

    Julian

  • Sorry... apparently it works fine for embedded image, but fails with linked images (I only use linked images, so I forgot to mention that).

    I've sent you an example. Here are the instructions:

    The example shows three panels, the upper left is the main WPRichText which has an embedded image to illustrate the difference between embedded and linked images after a merge, the upper right is the template, and the lower panel is the merge result.

    1. Run the app
    2. Position the text cursor in the main panel (upper left)
    3. Click the Image menu and chose to insert a linked image.
    4. Pick the image I supplied which is alrady resized, or pick your own.
    5. Right click the image and select to position the image relative to the paragraph with autowrap left AND right.
    6. Click the File menu and select Merge
    7. View the results in the lower panel.

    This worked with 5.17.4 and maybe 5.18.3 (I'll have to backtrack to confirm), but fails with 5.18.6 and 5.18.7

    Please advise, thanks
    Eric

    • Offizieller Beitrag

    Thanks for the demo. Yes, I see the problem. The image is copied but
    changes to an embedded image. This means it looses its "PositionMode"
    For some reason this does not happen with the second image.

    You can fix that by using WPTOOLS format

    Code
    procedure TFMMImageTest_Main.WPRichText_MergedMailMergeGetText(
      Sender: TObject; const inspname: String;
      Contents: TWPMMInsertTextContents);
    begin
      if SameText( inspname, '$doc' ) then
      begin
        Contents.options := [ mmUseFirstLoadedParProps ];
        Contents.StringValue := WPRichText_Main.AsANSIString('WPTOOLS'); // was "AsString"
      end;
    end;

    I will extend the RTF writer/reader to add some prop proprietary
    options (pm, px, py, pw)
    If that has worked before - maybe the image was not linked?

  • Thanks... the quick fix about using AsANSIString seems to work.

    As for why it worked before...

    That might be possible that they were not linked images before. While I start off using linked images throughout, I had a "LoadImages" routine which resolved paths and loaded the linked images when I generated my document for printing. With a recent WPTOOLS change that required me to resolve my image link paths at a different point in my app, I found I no longer needed to call the LoadImages routine, letting WPTools do it all.

    By your comment, it sounds like my old routine was making all the linked images into embedded images, but not anymore since I no longer had to do that. Hence the reason it probably worked before as you suspect.