Exception: There are too much formats in the worksheet

Hi,

When I used Workbook.Save(), thrown exception:

Hi,

Please try the new fix v7.2.0.6

If you still find any issue, kindly do create a sample console application, zip it and post it here with all the template file(s) to reproduce the issue on our end. We will check it soon.

Thank you.

Hi,

don't work.

the problem is xls version.

When I save with xlsx format, it's work.

See sample project.

Thank you.

Hi,

Thanks for your posting and using Aspose.Cells for .NET

I was able to replicate the problem with the latest version:
Aspose.Cells
for .NET v7.2.0.6
using the code given below.

We have logged this issue in our database. Development team will look into this issue, once the issue is resolved or we have some other update for you relating to this issue, we will let you know asap.

This issue has been logged as CELLSNET-40667.

I have attached the screenshot for a reference.

C#


string filePath = @“F:\relDocEntradaItem.xlsx”;

//Create a workbook object from the template file
Workbook workbook = new Workbook(filePath);


//Save the workbook
workbook.Save(filePath + “.out.xls”);


Exception:
An unhandled exception of type 'Aspose.Cells.CellsException' occurred in Aspose.Cells.dll

Additional information: There are too much formats in the worksheet

Screenshot:

Hi,

It’s the limitation of xls file that there are too much ranges in one conditional formatting.

Could you please show us how to create such file?

Hi,

CellArea cellAreaRow = new CellArea();
cellAreaRow.StartColumn = tb.StartColumnIndex;
cellAreaRow.StartRow = this.StartRowIndex;
cellAreaRow.EndColumn = tb.EndColumnIndex;
cellAreaRow.EndRow = this.EndRowIndex;

int ixConditionalCollection = wb.Worksheets[tb.WorksheetIndex].ConditionalFormattings.Add();
FormatConditionCollection fcs = wb.Worksheets[tb.WorksheetIndex].ConditionalFormattings[ixConditionalCollection];
fcs.AddArea(cellAreaRow);
int ixConditional = fcs.AddCondition(FormatConditionType.Expression);

FormatCondition fc = fcs[ixConditional];
fc.Formula1 = "=MOD(ROW(),2)";
fc.Style.BackgroundColor = Color.Gainsboro;

Hi,

Thanks for your sample code.

I was not able to reproduce the problem using your code. In order to run your code, I have to modify it a little because it had built errors.

Could you please provide a code that could be run and replicate the problem?

Please see the code below. I am attaching output.xlsx and output.xls file.

First your code is run and it creates output.xlsx file, then next code loads the output.xlsx file and saves it as output.xls file which should throw exception but it is not throwing any exception.

I have used the latest version:
Aspose.Cells
for .NET v7.2.0.7

Please download and try it.

C#


//Instantiating a Workbook object

Workbook wb = new Workbook();


Worksheet worksheet = wb.Worksheets[0];


CellArea cellAreaRow = new CellArea();

cellAreaRow.StartColumn = 0;

cellAreaRow.StartRow = 0;

cellAreaRow.EndColumn = 2;

cellAreaRow.EndRow = 10;


int ixConditionalCollection = wb.Worksheets[0].ConditionalFormattings.Add();

FormatConditionCollection fcs = wb.Worksheets[0].ConditionalFormattings[ixConditionalCollection];

fcs.AddArea(cellAreaRow);

int ixConditional = fcs.AddCondition(FormatConditionType.Expression);


FormatCondition fc = fcs[ixConditional];

fc.Formula1 = “=MOD(ROW(),2)”;

fc.Style.BackgroundColor = Color.Gainsboro;


wb.Save(“output.xlsx”);


//Create a workbook object from the template file

Workbook workbook = new Workbook(“output.xlsx”);


//Save the workbook

workbook.Save(“output.xls”);



This issue occurs because was generating xls with many columns.

I changed the copy method (Cell.CopyRows to Range.Copy) and worked.

See CELLSNET-40666.

Thank you.

Hi,

It’s good to know that your issue is resolved now because of Range.Copy() method.

Range.Copy() method is very useful in combining the multiple worksheets into a single worksheet, therefore, I have also added an article relating to it inside documentation.

Combine Multiple Worksheets into a Single Worksheet

Hi,

Please download and try the latest fix: Aspose.Cells for .NET v7.2.1.3

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


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