Currency Format of Mail Merge

Hi,

When i used this format #",0.00" for my currency when creating the template for mail merge by using Aspose, it cannot work. However, when i used this format # #,###.00, it can work fine, the number with thousand separator and two decimal, may i know why? Thank you very much.

Hi Ong,

Thanks for your inquiry and sorry for the delayed response. Please note that, by default, Aspose.Words uses the culture of current thread which may affect the output of fields with format switches. I think, in your case, you can safely use the second number format switch (i.e. # #,###.00):

Please let me know if I can be of any further assistance.

Best Regards,

Hi,

Currently all templates we are using this format #, #.00, hence it is a problem to change all those templates, we prefer modify the codes than modify the format. This problem can be fixed by version upgrade or code changes instead of format changes? Our Aspose version is 6.4.0.0.

Thank you very much.

Hi Ong,

Thanks for your inquiry. First of all, I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.2.0 and let us know how it goes on your side. I hope, this will help.

Secondly, I think, in your case, you can simply modify the existing number format switch by using the following code snippet:

Document doc = new Document(@"C:\temp\test.docx");

NodeCollection starts = doc.GetChildNodes(NodeType.FieldStart, true);
foreach (FieldStart start in starts)
{
    if (start.FieldType == FieldType.FieldMergeField)
    {
        Run fieldCode = start.NextSibling as Run;
        fieldCode.Text = fieldCode.Text.Replace("\#, #.00", "\# #,###.00");
    }
}

I hope, this will help.

Best Regards,

Hi,
I tried to upgrade still cannot work.
Then, for second one, i convert it to .net (VB), also cannot wor, the microsoft word did not appear the number i put, but then appear this one {# #,###.00}
It did not merge the number, but then dislay the format only.
My code as shown below. Thank you.

Dim starts As NodeCollection = docTemplate.GetChildNodes(NodeType.FieldStart, True)
For Each start As FieldStart In starts
If (start.FieldType = FieldType.FieldMergeField) Then
Dim fieldCode As Run = start.NextSibling
fieldCode.Text = fieldCode.Text.Replace("\#, #.00", "\# #,###.00")
End If
Next start
docTemplate.Save(templateFileName)
docTemplate.MailMerge.Execute(inDataTable)

Hi
Ong,

Thanks for your inquiry. Could you please attach your input Word document along with the target output document here for testing? I will investigate the issue further and provide you more information.

Best Regards,

Hi,

I have sent 2 email (Title : Mail Merge Issue … ) to you with attachment due to security concern. Thank you very much for your help.

Hi Ong,

Thanks for sharing your documents via email. I think, the mergefields in your documents are syntactically ill-formed. I would suggest you please read the following links to learn more about fields in MS Word:
http://office.microsoft.com/en-us/word-help/insert-and-format-field-codes-in-word-2007-HA010338798.aspx#BM8
http://office.microsoft.com/en-us/word-help/field-codes-mergefield-field-HP005186172.aspx

Please let me know if I can be of any further assistance.

Best Regards,

Hi,

My issue has been fixed.

Thank you very much.

Hi Ong,

Thanks for your feedback. It is perfect that you managed to resolve the problem on your side. Please let us know any time you have any further queries.

Best Regards,