Free Support Forum - aspose.com

There are too much formats in the worksheet

Hi,

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.

Best regards

Hi,

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 v7.0.1.5

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.

Exception:

Aspose.Cells.CellsException was unhandled
Message=“There are too much formats in the worksheet”
Source=“Aspose.Cells”
StackTrace:
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 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:



C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;

using Aspose.Cells;

//call WindowsFormsApplication2.Form1XX.Run();

namespace WindowsFormsApplication2
{
public partial class Form1XX
{
private int _numberOfRows = 4;
private int _startRow = 9;

public static void Run()
{

Form1XX fm = new Form1XX();
fm.button1_Click(null, null);
}

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[0];

//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);

//Copy Range
rng.Copy(masterRange, po);

//Add row information …
}

ws.CalculateFormula(true, true, null);

try
{
//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”);

}
}
}
}

Hi,

We have fixed this issue. Please download: Aspose.Cells for .NET v7.0.1.6

Hi,


Thank you. The error is fixed.
But now the conditional formattings are not copied via the range.copy method.

PFA the example excel files and a project to reproduce this issue.

Best regards

Hi,

Thanks for your sample project and files. We will investigate this issue and update you asap.

Hi,

We can see, the conditional formatting is lost after the range copy as shown in the screenshot.

Screenshot:

Hi,

We have fixed this issue. Please download: Aspose.Cells for .NET v7.0.1.7

The issues you have found earlier (filed as 31102) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.