Can I access merge field formatting rules from code?

Hi,

I want get access to the extra mergefield information that users might add to document templates. For example, they might specify the “data to be inserted before the merge field”…

Is it possible when I process the document and apply the mail merge that I can get access to this extra information at all?

Thanks

Hi
Thanks for your request. Merge field formatting is applied using formatting switches. Unfortunately, there is no direct way to access them upon executing mail merge. The only way to access them is getting and parsing field code. Field code is the text between FieldStart and FieldEnd nodes of the appropriate field. You can see field codes in MS Word by pressing Alt+F9.
Best regards,

Hi

The field code that I have looks like this:

{MERGEFIELD CourseDate.EndDate \@ "dd-MMM-yyyy h:mm am/pm"}

Can I get at this raw data and parse this?

Hi
Thanks for your request. Yes, you can, but there is no direct way. You can use the same approach as used here:
https://docs.aspose.com/words/net/working-with-form-fields/
Best regards,