We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

MailMerge - how can we control the format of dates?

We are using DocIO to merge a word document which contains a few date fields. The date fields are fed into the merge directly from a datatable. When the merge is executed the dates are merged with the time component (in our case it's 00:00:00 AM).

The problem is we don't want the time component to show up if it's 0. Is there anything we can do to control the formatting or hide the time component if it's 0?


3 Replies

NB Nithya B Syncfusion Team July 17, 2014 11:27 AM UTC

Hi Shamsul,


Thank you for your interest in Syncfusion products.

 

Your requirement to preserve date format or hide time part if time is 00:00:00 AM is achievable using DocIO, while mail merging Word document with date value from a data table.

1.   Define date format for the mail merge field in the input Word template document as below.

          Syntax: { MERGEFIELD “Mergefieldname”  \@ “ DateTime Format” }

          Example: { MERGEFIELD  Date \@ "dd-MMM-yyyy" }

2.   Format the merged date value if time is 00:00:00 AM, on demand while mail merging using mail merge event handler of DocIO. Please refer our UG documentation from the below link for more information regarding mail merge event of DocIO.

UG link:

http://help.syncfusion.com/ug/windows%20forms/documents/mailmergeevents.htm

We have prepared sample to illustrate the above mentioned solutions while mail merging using DocIO. Please do find the attached sample and let us know this helps you.

 

Please let us know if you have any other questions

 

Regards

Nithya


Attachment: Sample_MailMegeWithDateTime_51d6c256.zip


GB Graham Bishton April 28, 2022 03:50 PM UTC

Is it possible to do something similar with a formatter for a boolean MERGEFIELD which is in a DataGroup ?



SB Suriya Balamurugan Syncfusion Team April 29, 2022 06:42 AM UTC

Hi Graham,

From the given details, we have suspected that your requirement is formatting to the merged text or customize the merged text during mail merge process using the MergeField Event.

To achieve your requirement, please refer to the below UG documentation link,
https://help.syncfusion.com/file-formats/docio/mail-merge/mail-merge-events#mergefield-event

If we misunderstood any of your requirements means, please share with us the complete details about your end requirement. Also, kindly share with us the input template and the expected output document/screenshot. Thereby, we will check the feasibilities to meet your requirement and will provide you with the appropriate solution at the earliest.

Regards,
Suriya Balamurugan.


Loader.
Live Chat Icon For mobile
Up arrow icon