We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

MailMerge with Dates

Hi Aspose Dev -

I have a document with some MergeFields that will be merged with Date data.

Currently, the MergeField does not contain any Format picture-switches for date format,

such as “\@ MM-DDD-YYYY”. I am adding the formats to the MergeFields programmatically.

Now the name of these Date MergeFields are “Birth_Date”, “Start_Date”, etc. This worked

fine when the data source used to be a flat file containing pre-formatted date values and it was

merged as a string. The new data-source is now a data-view, with Date-Time columns that

define the data. It appears that MailMerge will not recognize the format specifiers if the

MergeField is named “Birth_Date”, but will work if named “Date”. I assume there is no way

around this? The format specifier in and of itself is not enough. In order to apply the date format, the MergeField itself must be named “Date”? There will be several date MergeFields on the form.

Thanks for your help -

bob kells

Hi Bob,

Thanks for your inquiry.

I cannot reproduce the issue using the latest version of Aspose.Words. I did however reproduce another issue which was the date formatting "DDD" was not applied properly whereas "ddd" was. I used the code below and the document attached for testing.

Document doc = new Document("MergeField Template.docx");<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

doc.MailMerge.Execute(new string[] { "Birth_Date", "Date" }, new object[] { DateTime.Now.ToString(), DateTime.Now.ToString() });

doc.Save(dataDir + "Document Out.doc");


Hi Adam -

I think my problem is that I was creating a merge field with { "Birth_Date", "Birth_Date" } values. I will try the values you describe above.

Thanks - bk

The issues you have found earlier (filed as WORDSNET-4350) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.