Free Support Forum - aspose.com

Numbers to be displayed as non-negative unless format specified

Hi,

We would like the number merged from data source to be non-negative as per data format that we specify:

{ MERGEFIELD “DocDescription” #,###.00 }

but it displays as negative. Please find the code sample below and the template attached.

        var dataFile =
            new XDocument(new XElement("Data", new XElement("PrimaryRecordSet", new XAttribute("ID", "Main"),
                new XElement("DocDescription", "-1,057.25"))));

        var mergeData = createDummyMergeData(dataFile);

        var document = new Document(@"Merge_Number_Switch_Format_337964.dotx");

        document.MailMerge.Execute(mergeData);
        document.MailMerge.ExecuteWithRegions(mergeData);

        document.UpdateFields();

        document.Save("OutputFiles/Output.docx");

Template: Merge_Number_Switch_Format_337964.zip (18.3 KB)

Could you please take a look?

Thanks,
Ewa

@acturisaspose,

Thanks for your inquiry. Please note that Aspose.Words mimic the behavior of MS Word. If you perform the same scenario using MS Word, you will get the same output.