EPPlus Calculate method not visible or accessible in Matlab

Viewed 174

I'm using EPPlus from Matlab as a .NET assembly:

NET.addAssembly(which('EPPlus.dll'));
p = OfficeOpenXml.ExcelPackage

So far, this has been working fairly well for me, and I've been able to successfully use nearly all the functionality in EPPlus. However, I just tried to run the Calculate method to evaluate some formulas, and the Calculate method doesn't appear to be visible. I tried on the workbook, worksheet, and individual cell. None of them work.

No appropriate method, property, or field 'Calculate' for class 'OfficeOpenXml.ExcelRange'.
No appropriate method, property, or field 'Calculate' for class 'OfficeOpenXml.ExcelWorksheet'.
No appropriate method, property, or field 'Calculate' for class 'OfficeOpenXml.ExcelWorkbook'.

It doesn't show up in the full methods list either.

I double checked back in C#, and the all the sample code works. So I know my DLL should be built properly. Any ideas why this method wouldn't show up?

1 Answers

It feels good to finally answer my own tumbleweed question. The answer is to call OfficeOpenXml.CalculationExtension.Calculate on the workbook, worksheet, or cell you want to calculate. Example:

NET.addAssembly(which('EPPlus.dll'));
p = OfficeOpenXml.ExcelPackage;
OfficeOpenXml.CalculationExtension.Calculate(p.Workbook)
Related