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

Free Support Forum - aspose.com

Aspose Word update SUM field seems not to work

Hi

I try to update a SUM(Above) or AVERAGE(Above) Field during a mail merge.

When I render the template all fields are filled with data except my SUM field.
I always have to update them manually in the docx word document but when doing this, it works fine.

I tried it with calling Document.updateFields and without calling it.

Here is the sample code:

// Implements IMailMergeDataSource
TableRootDocumentDataSource dataSourceTableRoot = new TableRootDocumentDataSource();
Document document = new Document(pathToTemplate);
document.getMailMerge().executeWithRegions(dataSourceTableRoot);
// Save the result
document.updateFields();
document.save(fileOutputStream, new DocSaveOptions(SaveFormat.DOC));

My template looks like this:

«TableStart:position» «name» «description» «price»«TableEnd:position»
Summe: {= SUM(ABOVE)}

After execution it looks like this:

Lord of the Rings DVD
Complete Lord of the rings collection
49
Summe: !Syntax Error

After updating it manually in the docx document it looks like this:

Lord of the Rings DVD
Complete Lord of the rings collection
49
Summe: 49

Am I doing something wrong or is it an bug in aspose?

Thanks for your help and best regards

Hi Martin,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document (template).
  • Aspose.Words generated output document which shows the undesired behavior.
  • Please create a standalone (runnable) simple application that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

Best regards,