Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
400
Excel Recalculation Not Working
posted

Hi there,

I've got a reasonably complicated Excel spreadsheet that I want to automatically calculate a whole load of values for me.

I've got code similar to the following which does this:

            var workbook = Workbook.Load(@"c:\temp\workbook.xlsx");

            workbook.SuspendCalculations();

            FillDataRow(workbook.Worksheets[0], dataReader);

            workbook.CalculationMode = CalculationMode.Automatic;

            workbook.ResumeCalculations();

            workbook.Recalculate();

            // code to extract calculated values

            workbook.Save(@"c:\temp\workbook - results.xlsx);

The trouble is, only some of the cells are recalculated.
If I open up the spreadsheet in Excel, everything looks great... because Excel recalculates the stale values.
I know it is doing this because it asks me if I want to save the spreadsheet.
NB there is nothing in the workbook that uses volatile functions.
Until this morning, I was doing this using v11.1
I have upgraded to v11.2 and am still facing the same issue.
Am I doing something wrong / missing something / or is Infragistics.Documents.Excel simply not capable of doing what I require??
Any help would be gratefully appreciated as I'm going to have to find another solution elsewhere if I can't get this to work VERY quickly!
Cheers,
James

Parents
  • 44743
    posted

    Are you sure there are values not calculating correctly? It is possible MS Excel is updating some other field in the file, like the version of the program which saved the file, or the internal calculation order cache.

Reply Children