Well, SUBTOTAL formula is currently not support by workbook.CalculateFormula(). We will get back to you after providing the feature / formula.
Please see the list of formulas currently supported by workbook.CalculateFormula() method.
And, you can try workbook.ReCalcOnOpen=true to recalculate the formulas when the workbook is opened. Please modify your code as follows,
var workbook = new Workbook();
workbook.ReCalcOnOpen=true;
workbook.Open("C:\\Files\\SubtotalFunction.xls", FileFormatType.Default);
// workbook.CalculateFormula();
var worksheet = workbook.Worksheets[0];
var cell = worksheet.Cells[0, 0];
Well, Workbook.ReCalcOnOpen property is used when you want all the workbook formulas to get automatically re-calculated when the workbook will be opened. Whereas, Workbook.CalculateFormula() method can be used whenever you want to calculate the result of the workbook formulas (may be after opening and manipulating the data of the workbook you want to calculate the results.). CalcualteFormula can be used at any time in your code as per your requirement to calculate the formula results but using ReCalcOnOpen will only automatically re-calculate when the workbook is opened.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.