Problem with sort unique in apose 25.1.2

Hi
I have an excel sheet were I use a sort unique formular.
I add data to the sheet and calculate it with this code:
workbook.CalculateFormula();
workbook.Settings.FormulaSettings.CalculationMode = CalcModeType.Automatic;
await _fileService.UploadWorkbookAsync(workbook, workBookpath);
return FileStreamResultHelper.GetFileStreamResult(workbook, fileName);

The file service uploads it to a storages account in azure.

When I download the sheet the formular is not calculated.
I have to go to the column and press enter in the formular line og press ctrl + alt + f9 for it to get calculated.
Am I doing something wrong or is there anyway to get this calculated ?

This is an example file.
Export 03-02-2025 16_32_00.zip (38.7 KB)

@nic11,

Thanks for the template Excel file and details.

SORT and UNIQUE are considered dynamic array formulas which can return results that automatically spill over into multiple cells in the worksheet. Could you please try to add a line (to refresh dynamic array formulas specifically) if it works for your needs?

workbook.RefreshDynamicArrayFormulas(true);
workbook.CalculateFormula();
workbook.Settings.FormulaSettings.CalculationMode = CalcModeType.Automatic;
await _fileService.UploadWorkbookAsync(workbook, workBookpath);
return FileStreamResultHelper.GetFileStreamResult(workbook, fileName);

Let us know if you still find any issue.

Thank you that helped

@nic11,

It is good to hear that the suggested line of code resolved your issue. Please don’t hesitate to reach out to us again if you have any further questions or feedback.