I am doing a mail merge by instantiating a TWPRichText in a class (not putting it on a form), assigning an RTF template, using a TWPMMDataProvider (also not on a form) and doing the usual mail merge routine as described in the manual.
After the mail merge the output TWPRichText has different left and top margins than the input document.
The mail merge template had \margl1788 and \margt773. The resulting document had \margl1882 and \margt1440.
It seems to me that the resulting values are the default values which is not what I want.
I tried assigning the header of the template
FMailMergeQry.Open;
FMailMergeQry.First;
try
i := 0;
lAllRichText.BeginUpdate;
while not FMailMergeQry.Eof do
begin
lTemplate.MergeText;
if i=0 then // FIRST RUN
begin
lAllRichText.AsString := lTemplate.AsString;
lAllRichText.Header.Assign(lTemplate.Header); // <- DIDN'T WORK
lAllRichText.CPPosition := MaxInt;
end
else if i>0 then // SUBSEQUENT RUNS
begin
but that didn't work either. Calling Loaded() after assigning AsString also didn't help.
Do you have any idea what am I doing wrong?