Grand total has not been calculated when using custom formula in smart markers

When using custom formula to fill the data in smart markers, the grandtotal like “=SUBTOTAL(9,C3:C4)” has not been calculated, but the subtotalN’s results are right.Even if I removed the subtotalN, the grandtotal still has not been calculated.grandtotal.zip (17.8 KB)

Here is the template file and output file.

@xuanniao,

Thanks for the template file.

Could you add the following line of code before saving the Excel file, it should work fine:
[C#]

workbook.Settings.ReCalculateOnOpen = true;

[Java]

workbook.getSettings().setReCalculateOnOpen(true);

Let us know if you still find any issue.

It does not work.

@xuanniao,

Please create and provide a simple sample code (runnable) with template file to reproduce the issue on how you are processing the markers with your data to produce the output. Please define source data in the template file itself or use some arrays/variables in code so the markers should be processed and cells are filled with data by it. This will help us evaluate your issue precisely to consequently figure it out soon.

grandtotal.zip (443.7 KB)
We defined some custom formula, here is the complete experimental code.

@xuanniao,

Thanks for the sample project and source files.

We will check your sample project soon. But we appreciate if you could provide a simplified and simple example code (with few lines of code) which should not have external or other platform dependencies to reproduce the issue on our end. This will help us to evaluate your issue quickly and precisely to consequently figure it out soon.

I found why the grandtotal had not been calculated, because I used cell.setValue instead of cell.setFormula to set the formula. Thank you!

@xuanniao,
Glad to know that your issue is resolved. Please feel free to write us back if you have any other query related to Aspose.Cells. We will be happy to assist you at the earliest.