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


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);
// Save the result
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
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
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,