MERGEFIELD number formatting

@Ajisha Sure. Every Aspose license provides a 1-year subscription for free upgrades to any new Aspose.Words version that comes out.

@alexey.noskov No I am not talking about only 1 year.
My question is If my company buys aspose.total will the package have the fix that you have for merge formatting ? If not I need to tell them then there is no point in buying the aspose.total. We can only buy aspose. words package.
Presently we have only the aspose.words 20.8 version if we were to upgrade to aspose.words will it support the merge formatting. If possible can you please try on your end and let me know.

@Ajisha The issue has been fixed and the fix has been included into the 24.4 version. So in the next version the fix will be there too.

Thank you so much. :grinning:

@alexey.noskov We discovered one more problem with the pdf conversion.

After the mail merge is done. I get the document as word file saved, Please find the file below attached.
However when I convert this to pdf using aspose the french date is not converted to french and it displays in english date. I have attached the pdf file as well.
000799706 1_FRR804FN_003728358_1.docx (96.8 KB)

208513_FRR804_FRR804FN_202473_22374.pdf (124.1 KB)

Thank you in advance for checking this.
Methods to convert to pdf.7z (1.5 KB)

@Ajisha To avoid updating the fields when converting to PDF, you can use the following code:

Document doc = new Document("input.docx");

PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.UpdateFields = false;

doc.Save("output.pdf", saveOptions);

@alexey.noskov

This is a common method for all the files, so it will not change any other scenarios right?

@Ajisha This is just a workaround. It doesnā€™t guarantee that problems willnā€™t caused. I will create a bug about this.

@Ajisha
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WORDSNET-27168

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you so much.

1 Like

@vyacheslav.deryushev

I have two approaches
this is the one that you suggested,
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.UpdateFields = false;
asposeDoc.Save(copyFilePathAndName, saveOptions);

This is the one I got from your support website Use French Culture from DATE Field Formatting Properties (Language Setting) & Convert DOCX to PDF using Aspose.Words (C# .NET)

doc.FieldOptions.FieldUpdateCultureSource = FieldUpdateCultureSource.FieldCode;

I am not sure which one to use. Both of them works Can you please give me suggestions?

@Ajisha Thanks for pointing.

doc.FieldOptions.FieldUpdateCultureSource = FieldUpdateCultureSource.FieldCode;

would be more effective for you.

Thank you so much.

1 Like

@alexey.noskov Hi

Our organization got the liccense for aspose.total however last time we had only aspose.words. Will there be any changes in the logic if I want to use aspose.words from aspose.total or it works like the existing code.

@Ajisha Aspose.Total is a type of license that includes all Aspose products. So you can use any of them separately without changing your code.

@alexey.noskov Thank you for all your help we got the license. However, The same logic does not work when we have this date format in the template

Can you please give us a fix for this we are currently using latest released aspose.words version and our license is total.
FANREN_Date Issue.docx (60.1 KB)
This is the line of code we use.

doc.FieldOptions.FieldUpdateCultureSource = FieldUpdateCultureSource.FieldCode;

I have attached the document for your reference.

@Ajisha Could you please elaborate the problem in more details? As I can see Aspose.Words properly update the field value. I used the following simple code for testing:

Document doc = new Document(@"C:\Temp\in.docx");
foreach (Field f in doc.Range.Fields)
{
    if (f.Type == FieldType.FieldDate)
        Console.WriteLine(f.DisplayResult);
}
Console.WriteLine("==========================");

doc.FieldOptions.FieldUpdateCultureSource = FieldUpdateCultureSource.FieldCode;
doc.UpdateFields();
foreach (Field f in doc.Range.Fields)
{
    if (f.Type == FieldType.FieldDate)
        Console.WriteLine(f.DisplayResult);
}

The output is the following:

    03 avril 2014
29 aoƻt 2024
29 aoƻt 2024
==========================
03 avril 2014
30 aoƻt 2024
30 aoƻt 2024

@Ajisha We have finished analyzing WORDSNET-27168 and concluded that this is not a bug. By default, AW updates fields with the current culture. To update some fields (e.g. DATE, TIME) with the field code culture (as MS Word does), you need to set the Document.FieldOptions.FieldUpdateCultureSource property to FieldUpdateCultureSource.FieldCode. This solution is similar to the one suggested to you earlier.

The issues you have found earlier (filed as WORDSNET-27168) have been fixed in this Aspose.Words for .NET 24.10 update also available on NuGet.

How to set cell table shading dynamically same as

Setting Background Color Dynamically

<<backColor [ā€œredā€]>>text with red background<</backColor>>

Can you please give me the template syntax for this ?