Free Support Forum - aspose.com

Thousand separated number format

Hi,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I use Aspose.Words 4.4.0.0 for .Net to generate Word doc.

I perform MailMerge from a Datatable.

document.MailMerge.ExecuteWithRegions(dataTable);

My requirement is to set Thousand separated format for a column as below.

Column A

1,015

1,025

1,035

1,045

1,055

1,065

Can you help me in achieving this functionality.

Thanks in advance.

-- Nithiyanandam

Hi

Thanks for your inquiry. I think that you can try using picture switches to achieve this.

For example see the following field code.

{ MERGEFIELD Price \# "#,##0.00" }

Here is code for testing.

string[] names = { "Price" };

object[] values = { 10000 };

//Set current culture

string UserLocale = "en-US";

System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(UserLocale);

//Perform mail merge

doc.MailMerge.Execute(names, values);

I hope that this information will help you.

Best regards.

Hi. Thanks for your reply.

Will this only work for Thousands? Because the input data can also be 100000 or 10000000. The data should be formatted accordingly as 1,00,000 or 1,00,00,000.

Thanks,

Nithiyanandam

Hi

Thanks for your inquiry. Please see the following link to learn more about formatting fields with switches.
http://www.gmayor.com/formatting_word_fields.htm

Best regards.