We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Space as thousand separator in mail merge field format

Hi!

What mail merge format should the user define if he wants thousand spearation with space and want to see decimal places?. eg.: “78 360,06"

These are NOT working
”\# ### ### ### ### ##0.00" : the output is “78360” (missing decimals)
"\# ##0.00" : the output is : “78360,06” (no separation)
"\# ##0.00" : the output is : “78360,06” (no separation)
"\# ,##0.00" : the output is : “78360,060.00” (totally wrong, not a number)

Hi Kálmán,


Thanks for your inquiry. Please see attached input/output Word documents and following code:

Document doc = new Document(MyDir + @“in.docx”);

CultureInfo currentCulture = Thread.CurrentThread.CurrentCulture;

Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR");

doc.MailMerge.Execute(new string[] { "mf" }, new object[] { 78360.06 });

doc.Save(MyDir + @"17.2.0.docx");


You want a comma as a decimal separator. You should set a culture where decimal separator is comma. The pattern in attached document is correct, but the final format depends on the culture.

Hope, this helps.

Best regards,

Hi Kálmán,


Please use the following code to achieve the same by using Aspose.Words for Java:
<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>
<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document doc = <span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>new <span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>Document(<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>“D:<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>\<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>temp<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 0, 128); font-weight: bold;”>\<span style=“font-family: “Courier New”; font-size: 9pt; color: rgb(0, 128, 0); font-weight: bold;”>in.docx”<span style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>);
<pre style=“background-color: rgb(255, 255, 255); font-family: “Courier New”; font-size: 9pt;”>
Locale currentCulture = Locale.getDefault();
Locale.setDefault(new Locale(“fr”, “FR”));

doc.getMailMerge().execute(new String[] { “mf” }, new Object[] { 78360.06 });

doc.save(“D:\temp\awjava-17.2.0.pdf”);

Best regards,

Hi!

Your in.docx gave me the answer, this is OK :
"\# “### ### ### ### ###0.00"” : the output is : “78 360,06”.

Thank You!

Hi Kálmán,

Thanks for your feedback. In case you have further inquiries or need any help in future, please let us know.

Best regards,