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