Free Support Forum - aspose.com

Date formatting for mergefield--How to control display

Hi, I was hoping you could provide me with an answer to this question–I am using a picture switch to format a date value mergefield (ie /@ yyyy/M/d) but the problem is that if the datafield I merge with is null, the output is “0001/1/1” when I don’t want it to display anything. I was under the impression that the MergeFormat field switch is not applied if no data is merged, at least this is the case according to the MS Word documentation. Am I missing something? I have too much data and I don’t want to have to format the columns in my datatable to achieve this

Hi,

If you use a merge field code like this

{ MERGEFIELD Date @ yyyy/M/d * MERGEFORMAT }

and the field value is null, no output should be made. Please make sure that null is indeed passed for that field.