Printing after mailmerge creates 2 copies instead of 1.

  • WPTools v4.20

    Printing after mailmerge creates 2 copies instead of 1. Below is the code to implement mailmerge.

    • Offizieller Beitrag

    I am sorry, but your source code does not make much sense to me. Normally to print just one letter you need nothing else than

    aSource.MergeText;
    aSource.Print;

    To print multiple letters you use a loop such as

    Code
    aOutput.Clear;
    aOutput.FastCopyProperties(aSource); 
    while not DataSet.EOF do
    begin
      aSource.FastMergeText;
      aOutput.FastAppendtext(aSource);
      DataSet.Next;
    end;
    aOutput.Print;
  • Sorry for the confusion. But here's what I did to reproduce the same problem.

    I declared a TWPRichText object and create a parented handle through application.

    { WPTools v4.20 }
    procedure print(const aRTFValue : string);
    begin
    aWPText := TWPRichText.CreateParented(Appliation.Handle);
    try
    aWPText.AsString := aRTFValue;
    aWPText.Print;
    finally
    aWPText.free;
    end;
    end;

    Note:
    aRTFValue parameter is the RTF string value of the template/document.

    But each time the code calls print, it doubles the print out.

    Thanks.