Capturing individual mail merge letters
Hi,
I have the standard setup for mail merge, with a TppRichText control in a
detail band, and one detail band per record. If I code an event handler for
the TppBand's AfterGenerate event, and retrieve TppRichText.RichText at that
point, the data I get has the names of the fields in it, not the merged data
from the database.
We'd like to save off the text of the letters individually, partly for
auditing, partly for other future reference. Anybody found a way to do
that?
Mike Carroll
mcarroll@gosigma.com
I have the standard setup for mail merge, with a TppRichText control in a
detail band, and one detail band per record. If I code an event handler for
the TppBand's AfterGenerate event, and retrieve TppRichText.RichText at that
point, the data I get has the names of the fields in it, not the merged data
from the database.
We'd like to save off the text of the letters individually, partly for
auditing, partly for other future reference. Anybody found a way to do
that?
Mike Carroll
mcarroll@gosigma.com
This discussion has been closed.
Comments
RichText.OnDrawCommandCreate event. Since you'll have multiple ones, you'll
want to build the destination filename dynamically.
uses
ppDrwCmd;
procedure Tfrm0028.ppRichText1DrawCommandCreate(Sender, aDrawCommand:
TObject);
begin
TppDrawRichText(aDrawCommand).RichTextStream.SaveToFile('C:\mailmerge.rtf');
end;
Cheers,
Jim Bennett
Digital Metaphors
http://www.digital-metaphors.com
info@digital-metaphors.com
property is protected, but it's possible to gain access to it by subclassing
TppRichText. When the AfterGenerate event fires, the DrawRichEdit property
contains the data that has been merged from the database record, in place of
the field names. But it does not seem to contain the RTF formatting
information, for some reason I haven't figured out yet. So it's possible to
save the contents of DrawRichEdit in AfterGenerate; it contains the correct
data but not formatted properly. This may be adequate for some purposes.
Mike Carroll
mcarroll@gosigma.com