Setting font size in merge text is being ignored

  • in my WPRichTextMailMergeGetText event I have the following code

    contents.MergeAttr.GetFontSize(i);
    Contents.MergeAttr.SetFontName('Times New Roman');
    contents.MergeAttr.SetFontSize(frmECMain.PatientInfo.DIFontSize);
    contents.StringValue := GetAnswer(inspname);
    Contents.MergeAttr.SetUnderlineMode(1);


    everything is working except the setfontsize, this is being ignored.

    If I do a get contents.MergeAttr.GetFontSize(i); I comes back with the correct font size that was just set, but it is not reflected in the document

    Bern

  • Bern,

    Until Julian checks in with the real answer, if you aren't doing this already, try adding the following when the document's processing is finished:

    Code
    wpRichText.ReformatAll( TRUE );
       wpRichText.Refresh;


    I've even seen Julian suggest at times the ReformatAll() be used twice to be effective.

    Give it a shot!

    diamond

    • Offizieller Beitrag

    Hi,

    I used this code in the TBX demo and it works as expected:

  • I just doubled check and actually it looks like it is ignoring everything except for the contents.StringValue := part. Is their a setting somewhere that may have been messed up the prevents the merge fields from be changed?

  • I tripled checked and found out my getanswer function is passing back a WPT string not a straight string so that is over ridding what I am setting. I am glad I figured out why it was not working it was driving me crazy. Now all I have to do is fix my function to modify the result before sending it back