Number formatting


I am having some difficultys with number formatting when changing formfields in my template. Here in europe numbers are formated like this:(12.345,67). In word my formfield is formated with #.##0,00 but when i change my field value something get messed up. 1 is printed like 1,000000. Is there any solution to this problem?


Please attach the template and the resulting document as well as a code snippet sufficient to reproduce the problem.


Document doc = new Document(System.IO.Path.Combine(DocPath, “”));
FormFields FF = doc.Range.FormFields;

Hashtable element = new Hashtable();
element.Add(“NUMBER1”, 1210.0);
element.Add(“NUMBER2”, 3.0);
element.Add(“NUMBER3”, 2.5);
element.Add(“NUMBER4”, 25670.88);


return doc;

The result attached is the result i get if my regional settings are set to Slovene (as it should be). If i change that to English(US) the numbers are written in the same way, and there is a ‘.’ instead of ‘,’.

Remember… numbers should look like 12.345,67


And the template…


I forgot to mention that i did manage to get the right number formatting when I changed the format of my numbers to US format #,##0.00 (instead of europan; #.##0,00). This is strange, that with the opposite forrmating thing works. Remember that custmers will be using this software which cannot change there regional settings or templates.


When i was trying to figure out what is wrong i found out:
If i switch ‘.’ and ‘,’ characters, the formatting works (also for others format like 0,0000 (decimal) 1.000.000 (millions)). Now, if i open the parsed document when regional settings are set to slovene the number is written in our format and if i change regional settings to US, the number is written in US format. Looks like that changing number format of formfield has no function and it allways has to be an US format and the nubmer shown in document is written like the regional settings are set.

This finding does not solve the problem because we need to genereate booth type of documents (with US and our format).

If anyone finds anything, let me know please!!!


Aspose.Words uses .NET Framework to parse and apply date and number formats like described in MSDN:

From the above you can see .NET Framework understands only "US style separators" in the custom format strings.

But the output that will be produced will of course depend on the regional settings specified on the machine.

If it is an ASP.NET application, then regional settings for the aspnet account will have effect I believe.


The issue is tricky. Please give me one more day for research. I need more testing to provide a qualified answer.

Best regards,


I edited my previous post. You need to use US-style separators in number formats in the documents because the .NET Framework only understands them.