Hey There,
We have a client that has an excel file containing a pivot table. File named ‘stack-overflow-pivot-table’ attached. When trying to create a new workbook with Aspose.Cells v25.7.0 using the following code:
public static void OpenWorkbook(string inputPath)
{
using FileStream ms = new FileStream(inputPath, FileMode.Open);
var wb = new Workbook(ms, new LoadOptions(LoadFormat.Xlsx));
}
We get the following exception
System.OverflowException: ‘Arithmetic operation resulted in an overflow.’
Please advise,
Thanks,
Shlomi
stack-overflow-pivot-table.zip (80.5 KB)
@shlomi.z
Cause
The System.OverflowException
you are encountering when trying to open the Excel file with a pivot table is likely due to an issue with the data or structure of the pivot table in the workbook. This can occur if the pivot table references invalid data or if there are calculations that exceed the limits of the data types used.
Solution
To troubleshoot and resolve this issue, please follow these steps:
-
Update Aspose.Cells: Ensure you are using the latest version of Aspose.Cells, as there may have been bug fixes or improvements related to pivot tables in newer releases.
-
Check the Pivot Table: Open the Excel file in Microsoft Excel and inspect the pivot table for any inconsistencies or errors. Verify that all data sources are valid and that there are no circular references.
-
Load Options: Experiment with different load options when opening the workbook. For instance, set LoadFormat.Auto
to allow Aspose.Cells to automatically determine the format.
-
Simplify the Workbook: If feasible, create a simplified version of the workbook containing only the pivot table and minimal data to see if the issue persists. This can help isolate the problem.
Code
Here’s a modified version of your code that uses LoadFormat.Auto
:
public static void OpenWorkbook(string inputPath)
{
using FileStream ms = new FileStream(inputPath, FileMode.Open);
var loadOptions = new LoadOptions(LoadFormat.Auto);
var wb = new Workbook(ms, loadOptions);
}
Next Steps
If the problem continues after trying the above steps, please share the simplified workbook with Aspose support for further investigation. They can provide more specific guidance based on the file’s content.
Please let me know if you need any further assistance!
@shlomi.z
By testing with sample file and code on the latest version v25.7, we can reproduce the issue. OverflowException(Arithmetic operation resulted in an overflow) occurs when opening xlsx file.
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CELLSNET-58772
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@shlomi.z,
We are pleased to inform you that your issue (Ticket ID: “CELLSNET-58772”) has been resolved. The fix/enhancement will be incorporated into the upcoming release of Aspose.Cells (v25.8), which is scheduled for the first half of August 2025. You will be notified when the new version is published.
Hi,
Thanks for the quick response.
- Until there’s a new version (25.8) with the fix is there a workaround we can apply for our customers?
- We also obtain a Paid Support user. Is it possible to get a hotfix version?
Thanks,
Shlomi
@shlomi.z
If you have paid support user according to Paid Support Services, please use that user to post one request in the paid support forum. And then we will provide the hot fix tomorrow accordingly.