InputTextFieldName('DATE') value not updating to current date on merge and save to HTML

  • Using version 7.33.1 with Delphi Tokyo Update 2.

    Here is basically what I'm doing in code to create an HTML email from WPTools document.

    1. Inserting dates into documents using using wp.InputTextFieldName('DATE').

    2. Docs are saved/loaded from a database using using wp.LoadFromStream(mergefilestream);

    3. Data is queried and the merge begins something like this:

    wp.MergeText('', true);

    wp.SaveToString('HTML', False);

    In the merged document that is saved to HTML, the DATE value is not the current date but rather the date the "DATE" was inserted using the "InputTextFieldName" method.

    Still the document shows the value saved in the original RTF the day the document was created with the DATE field.

    For example, in the raw RTF I see {\field{\*\fldinst{DATE}}{\*\fldrslt{08/29/2017}}} In the merged RTF saved to HTML the value is still 08/29/2017 rather than today's date.

    Here is what I've tried.

    1. Rather than using InputTextFieldName('DATE') I used InputTextField(wpoDate); for new documents,

    2. OnMailMergeGetText

    if UpperCase(inspname) = 'DATE'

    then strVal := DateToStr(Now);

    3. OnTextObjGetTextEx

    if UpperCase(TXTObject.Name) = 'DATE' then


    PrintString := DateToStr(Now);

    TXTObject.Params := PrintString;


  • So those fields are not updated when the pages are created in a merged document and saved to HTML? At what point do the fields below get updated in the document?





    I don't clearly understand why the merged document works different when previewed as RTF or saved to HTML. The merge process up to that point is 100% the same, it's just at the end that the user can save to HTML rather than display. This is used for a custom email client app where the user creates docs in WPTools and merges them to send custom HTML emails. Users began reporting that the our "TODAY'S DATE" feature that uses wp.InputTextFieldName('DATE') seems to "stick" to the date the template was made rather than showing today's date. But only on the HTML output, not the RTF output.

    Seems like there must be a way to fix this or change how this works without using a merge data field via "InputMergeField". We use InputMergeField to create database field merge fields.

    This issue slipped pass our QA team and now we have customers that have inserted dates they expect to be "TODAY" on a merge and save to HTML. I'm not sure what we could do for these customer that have templates using the calc fields already since these fields are working for RTF previews.

    Does this issue make more sense now?

    Thank you for your help.