Mergfield font and size

  • Hi,

    When I insert a mergefield the mergefield has font=Arial + fontsize=655, regardless of the current font+size under the cursor.

    Is there a way to make sure the mergefield get the currently active font+size (where the cursor currently is placed in the document)?

    Code
    WPRichText.InputMergeField(lbVeldenLijst.Items[lbVeldenLijst.ItemIndex], lbVeldenLijst.Items[lbVeldenLijst.ItemIndex]);

    In OnShow-event of the form:

    Code
    WPLocalizeLoadForms := TRUE;
      WPTools_LoadVCLStrings;
      WPTools_LoadActionStrings;
      mbLettertype.Items := Screen.Fonts;
      WPRichText.DefaultAttr.Clear;
      WPRichText.DefaultAttr.SetFontName('Arial');
      WPRichText.DefaultAttr.SetFontSize(10);
      WPRichText.WritingAttr.Clear;
      WPRichText.WriteObjectMode  := wobRTF;
  • Well the cursor isn't moved at the moment the mergefield is added.

    Let's say that at the current cursor position the font=tahoma. Whenever a mergefield is added it is added as Arial with size 655.

    Any idea what might influence this behaviour?

  • Hi,

    I've installed version 6.20, but the problem remains.
    Below is my code I use to insert data into the editor. I seems everything is added with Arial 655.

    What could cause this?

  • MailingEditor.InputString('My string',0);
    Adds a correct string with default Arial 10.

    Omiting the two procedures below didn't change the behaviour.
    I don't understand why it doesn't work anymore as it worked previously.

    I do use USEEXPRESSBARS;


    Code
    procedure TFMailings.GaNaarEindeMergeVeld;var MergeVeld : TWPTextObj;begin  // Naar het einde van een mergeveld gaan indien de cursor op een mergeveld staat.  MergeVeld := MailingEditor.FieldAtCP;  If (MergeVeld <> Nil) AND (MergeVeld.ParentPosInPar <> MailingEditor.ActivePosInPar) then  begin    MailingEditor.TextCursor.MoveTo(MergeVeld.EndTag);    MailingEditor.CPMoveNext;  end;end;procedure TFMailings.GaNaarEindeBookmarkVeld;var BookmarkVeld : TWPTextObj;begin  // Naar het einde van een bookmarkveld gaan indien de cursor op een bookmark staat.  BookmarkVeld := MailingEditor.BookmarkAtCP;  If (BookmarkVeld <> Nil) AND (BookmarkVeld.ParentPosInPar <> MailingEditor.ActivePosInPar) then  begin    MailingEditor.TextCursor.MoveTo(BookmarkVeld.EndTag);    MailingEditor.CPMoveNext;  end;end;