TFF are not updated automatically

Hi Alex,
TFF are not getting updated automatically, which is causing problems during mail merge fields processing…

I have tried doc.updateFields(); before saving, but is of no use. I can only see them after doing the following steps:
1)select the text
2)update fields from the menu
3)save and reopen.

Please help me out.

Thanks,
Raghav
TFF_Fields_update_issue.docx (29.8 KB)

@raghud1005
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-26986

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.

For now you can try using the following code to update Form Fields manually:

Document doc = new Document("C:\\Temp\\in.docx");

for (Field f : doc.getRange().getFields())
{
    if (f.getType() == FieldType.FIELD_FORM_TEXT_INPUT)
    {
        // Get form field asociated with the field.
        FormField ff = (FormField)f.getSeparator().getPreviousSibling();
        // Clone field code Run to use the same font for value
        Run text = (Run)f.getStart().getNextSibling().deepClone(true);
        // set default text of the form field.
        text.setText(ff.getTextInputDefault());
        // Insert text after field separator
        if (f.getSeparator().getNextSibling().getNodeType() == NodeType.FIELD_END)
            f.getSeparator().getParentNode().insertAfter(text, f.getSeparator());
    }
}

doc.save("C:\\Temp\\out.docx");

The issues you have found earlier (filed as WORDSNET-26986) have been fixed in this Aspose.Words for Java 24.8 update.