Number formatting in mail merge field does not work using C#

Dear Support Team

I tried to mailmerge a document with the following merge field:
{ MERGEFIELD Document_Size \# "#'##0.00;-#'##0.00;#" }
The result should have been: 7'857.00, but it showed 7##0.00;-#857.00

Attached you see a document with the fields information.

Here my code:

Dim document As New Document(localcopy)
Dim keys(0) As String
Dim values(0) As Object
keys(0) = "Document_Size"
values(0) = CInt(7857)
document.MailMerge.Execute(keys, values)
document.Save(localcopy)

I tested it with Aspose.Word for .Net 11.1

Hi Sabine,

Thanks for your query. This is the default behavior of MS word. Please insert following merge field in MS words update the field and check the output.

{ MERGEFIELD 7857 # “#’##0.00;-#’##0.00;#” * MERGEFORMAT }

I tried it out, but I’m sorry, if I write # “#’##0.00;-#’##0.00;#” or # “#’##0.00;-#’##0.00;#” * MERGEFORMAT, both give me the same result.

Hi Sabine,

It would be great, If you share some more information about your issue. What exactly you want to do by using Aspose.Words. We are really keen to help you but need some more detail from your side.

Hi Tahir

While creating a test application for you, we figured it out.

At a certain location in our application we have set an invariant culture.
The invariant culture cannot evaluate #'##0.00;-#'##0.00;#, but it could evaluate #,##0.00;-#,##0.00;#.

Thanks for your help.

Hi Sabine,

It is nice to hear from you that you have figured this problem out. We always appreciate positive feedback from our customers. Let us know, If you have any more queries.