Thanks for your inquiry. Please call the Document.updateFields method before saving the document. Hope this helps you.
If you still face problem, please create a simple Java application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing. We will investigate the issue and provide you more information on this.
Thanks for sharing the detail. We have tested the scenario using latest version of Aspose.Words for Java 17.4 and have not found the shared issue. Please use Aspose.Words for Java 17.4. We have attached the output document with this post for your kind reference.