One of our customer is using an excel template to create a report.
The idea of the export is to copy a predefined range of 4 rows for each row of a table. Only the first copied row of the range will be filled. Via formulas the other 3 rows are filled. After that a formula in column A decides which row is visible.
When I try to save the workbook the exception ‘There are too much formats in the worksheet’ is thrown. I do not add any styles or formats to the workbook. So the count of different formats should be the same.
PFA a sample project to reproduce the error.
Thanks for your reporting and providing us a sample project to replicate this issue.
I was able to reproduce this issue using your code with the latest version:
Aspose.Cells for .NET v220.127.116.11
On saving output file in xls format, it throws the following exception but it saves successfully in xlsx format. I have attached the output xlsx file.
We have logged this issue in our database. Once we will get any update or fix regarding it, we will update you asap.
This issue has been logged as CELLSNET-31102.
Below is a code sample and the exception for a reference.
Aspose.Cells.CellsException was unhandled
Message=“There are too much formats in the worksheet”
at Aspose.Cells.Workbook.Save(String fileName, SaveOptions saveOptions)
at Aspose.Cells.Workbook.Save(String fileName)
at WindowsFormsApplication2.Form1XX.button1_Click(Object sender, EventArgs e) in F:\Shak-Data-RW\Projects\AsposeProject\AsposeProject\Class1.cs:line 53
at WindowsFormsApplication2.Form1XX.Run() in F:\Shak-Data-RW\Projects\AsposeProject\AsposeProject\Class1.cs:line 24
at AsposeProject.Program.f1() in F:\Shak-Data-RW\Projects\AsposeProject\AsposeProject\Program.cs:line 79
at AsposeProject.Program.Main(String args) in F:\Shak-Data-RW\Projects\AsposeProject\AsposeProject\Program.cs:line 57
at System.AppDomain._nExecuteAssembly(Assembly assembly, String args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String args)
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
public partial class Form1XX
private int _numberOfRows = 4;
private int _startRow = 9;
public static void Run()
Form1XX fm = new Form1XX();
private void button1_Click(object sender, EventArgs e)
string path = @“F:\Shak-Data-RW\Downloads\test\WindowsFormsApplication2\bin\Debug\test.xls”;
Workbook wb = new Workbook(path);
Worksheet ws = wb.Worksheets;
//Get template range
Range masterRange = ws.Cells.CreateRange(_startRow, 0, _numberOfRows, ws.Cells.MaxDataColumn);
Range rng = null;
PasteOptions po = new PasteOptions();
po.PasteType = PasteType.All;
//Add 500 dummy rows
for (int j = 0; j < 500; j++)
rng = ws.Cells.CreateRange(j + _startRow, 0, _numberOfRows, ws.Cells.MaxDataColumn);
//Add row information …
ws.CalculateFormula(true, true, null);
//Now exception ‘There are too much formats in the worksheet’ is thrown
wb.Save(path + “.out.xls”);
catch (Exception ex)
//Saving to xlsx does work
wb.Save(path + “.out.xlsx”);
We have fixed this issue. Please download: Aspose.Cells for .NET v18.104.22.168
Thanks for your sample project and files. We will investigate this issue and update you asap.
We can see, the conditional formatting is lost after the range copy as shown in the screenshot.
We have fixed this issue. Please download: Aspose.Cells for .NET v22.214.171.124