default font and mailmerge

  • I have a problem that I think is my fault but I'm not sure exactly what is going on... maybe you have some insight that can save me a bunch of time.

    We store multiple WPRichText into various database tables which are then used to append sections and mail merge into a final WPRichText.

    At one point, the customer had set his default font to be Times New Roman, and added a few comments. He later changed it to be Arial, and added a few more comments (each being in a different field in the database, and as such, each comment might have a different default font).

    When the final WPRichText is built using appends and mail merges, the final comment appended/merged in is Times New Roman, and so all the previous comments which had been set to the new default of Arial, gets changed into Times New Roman. I can even programatically set the WPRichText's default font at the end of the merge to what I want and all the text becomes that font, so I know that the Arial fonts are really set to "default font" now for some reason.

    So for now it "appears" that if I set a WPRichText text to the font that is the current "default font", it saves the font info as "use default font" rather than "use Arial" for example.

    Is there a way to say "never use default font, just use what I say to use"? Or am I mail merging incorrectly somehow?

  • Forgive my jumping in here. I think the office is closed for a couple of days, so I'll give this one a shot.

    I think what you're looking for is the SetOptions method. Supply the "-dontfixattr" parameter to that:

    Code
    YourEditor.SetOptions('RTF-dontfixattr');


    You might also want to check out TextLoadFormat. This one takes a string argument as well:

    Code
    TextLoadFormat := 'RTF-dontfixattr';


    Check out https://www.wpcubed.com/manual/formatstrings.htm for an up-to-date list of possible format options!

    I hope this helps point you in the right direction.

    Oh, and my customary disclaimer here: I *hope* (and believe), this is right, but I look to Julian to correct any misstatements I make, or point out cleaner ways.

    Regards,
    richard diamond

  • Thanks Richard!

    While SetOptions doesn't seem to be a method for a WPRichText (i.e. WPRichText1.SetOptions is not valid... or did I misunderstand?), your other suggestion of setting WPRichText1.TextLoadFormat seemed to have done the trick!

    Now my final merge report seems to look correct and uses the fonts that were selected no matter what the default font was for any particular database field that had RTF text. I'll have to test some other merges to be sure nothing else might have been adversly affected. But so far so good!

    So you're forgiven for jumping in ;)

  • Thanks Richard & ehimmer,

    I was having a problem with documents I made using the "UseDefEditor.exe" changing fonts to <default> when I applied a style.

    Put the line in the on the load.

    Thanks
    JAC