Hi,
In our application, we allow users to include tokens (wrapped in {}) that we then perform a string substitution on throughout the document. Some of these tokens are returned as dates, which then need to get converted to allow for date comparisons. For example:
{MERGEFIELD {custom:DATE-VALUE} @ “yyyyMMdd” * MERGEFORMAT }
Becomes
{MERGEFIELD “25/03/2016” @ “yyyyMMdd” * MERGEFORMAT }
But, when running the UpdateFields() command, the value remains at “25/03/2016”. If I open the resulting document in Word, and Update Field directly, then it correctly reformats as 20160325.
This is especially problematic when these two MERGEFIELDS are included in an IF statement for date comparisons - the values get compared based on the string values, so 25/03/2016 is after 24/12/2022.
Is there anything we can do to get the dates formatted correctly? We are currently using 16.4.0 for Words.NET.
Regards.
Daniel B.