FAQ

How to Fix the System.StackOverflowException on Workbook.CalculateFormula?

Sometimes, users face System.StackOverflowException on the Workbook.CalculateFormula method. This exception usually occurs because the default stack size of the IIS is too small (265 KB only). You can fix this error by creating another thread with an increased stack size and then moving your Workbook.CalculateFormula‑related code inside it.

Thickness of lines issue while rendering Excel to PDF

Sometimes, when an Excel file is converted to PDF, the thickness of lines differs in the output PDF. This issue is not caused by Aspose.Cells. It is caused by Adobe Reader when its settings “Smooth line art” and “Enhance thin lines” are checked. Unchecking these options will display the PDF correctly.

If you check “Smooth line art” and “Enhance thin lines”, the thickness of lines is different. See the following steps on how it’s done:

  • Go to Edit
  • Select Preferences
  • In the Page Display category, check the “Smooth line art” and “Enhance thin lines” options

If you uncheck “Smooth line art” and “Enhance thin lines”, the thickness of lines is the same. To achieve this, just follow the steps below:

  • Go to Edit
  • Select Preferences
  • In the Page Display category, uncheck the “Smooth line art” and “Enhance thin lines” options

How to Fix the System.OutOfMemoryException while Loading Large Spreadsheets?

There are fair chances that the Workbook constructor may throw System.OutOfMemoryException while loading large spreadsheets. This exception suggests that the available memory is insufficient to completely load the spreadsheet into memory; therefore, the spreadsheet has to be loaded while enabling the Memory Preferences.

Aspose.Cells APIs provide Memory Preferences to optimize memory consumption while loading & processing spreadsheets. These options are also helpful in efficiently loading large spreadsheets containing huge data sets into a Workbook object, as demonstrated below.

Determine which stack size is needed for a certain Workbook

Although we have enhanced the Aspose.Cells formula calculation engine and, in most cases, you should be able to get all the formulas calculated successfully for a given template file without specifying a smaller stack size, sometimes a StackOverflowException on the Workbook.CalculateFormula method might be inevitable. We provide new APIs for users to track formula calculations. We have added a class named AbstractCalculationMonitor and provided a property, i.e., CalculationOptions.CalculationMonitor, to help trace the issue.

Users may trace the stack size themselves using the APIs. Please note that checking the stack for every cell will surely degrade performance to a greater extent. See the sample code segment for your reference: