formatting mergefields

  • I use WPSuperMerge a lot. Most of the data for the merged-documents comes from database tables.

    if I want to use the database-field 'period_start' (datetime) and want to use a mergefield for period_start (format : dd.mm.yyyy) and a different mergefield for period_start (format hh:nn) how can I do that.

    (same question for numeric fields. on one place %9.2f on other places %9.3f)

    Is there a way to specify the formatting of the field ?

    Ad Franse

    • Offizieller Beitrag

    Hi,

    the merge fields do not use any format since they are just filled as string. You can, however, set the "Source" property of the respective insertpoint (the TWPTextObject with ObjType=wpobjMergeField) to hold an identifier for your needed format. Please avoid {} and slash characters in the string. If you need to use any character best hex-encode it.

    Regards,
    Julian

  • There are 3 situations.
    1. when creating the template wpRichText shows bla bla bla <<table.fieldname1>> bla bla bla
    if I click somewhere on the field how do I get the corresponding TWPTextObj ?

    2 If I have the TWPTextObj are there known issues / limitations on assigning the value to .source ?

    ( obj.source = hexencode( '%9.2f' );


    3. in WPSuperMerge.MailMergeGetText I get the TWPTextObj from contents.StartInspObject is that correct ?

    Ad Franse

    • Offizieller Beitrag

    1: You can use one of the OpenCode methods, i.e. function OpenCodes(X, Y: Integer; list: TWPTextObjList;
    CheckedCodes: TWPTextObjTypes; MaxCount: Integer = 0)
    : TWPTextObj; overload;

    2: If you use hexencode there are no limitations since hexcode is free of any characters which are control characters in RTF code. (The technique is quite common in RTF)

    3: Yes, this is correct.

    Julian