Error in Aspose.Cells.dll while using WorkBook.Copy()

We migrated Aspose.Cells.dll from 5.3.3.0 to 7.1.0.0.
We observed "Object reference not set to an instance of an object" when invoked WorkBook.Copy() while working with FormatCondition.
The stack trace is as below which does not give much information:
at Aspose.Cells.FormatCondition.(FormatCondition , CopyOptions )
at Aspose.Cells.FormatConditionCollection.(FormatConditionCollection , CopyOptions )
at Aspose.Cells.ConditionalFormattingCollection.(ConditionalFormattingCollection , CopyOptions )
at Aspose.Cells.Worksheet.Copy(Worksheet sourceSheet, CopyOptions copyOption)
at Aspose.Cells.WorksheetCollection.(WorksheetCollection )
at Aspose.Cells.Workbook.Copy(Workbook source)
The code which we are trying to execute before call to WorkBook.Copy() is as below:
FormatConditionCollection fcsLc = workbookDesigner.Workbook.Worksheets[1].ConditionalFormattings[indexLc];
int conditionIndexLc = fcsLc.AddCondition(FormatConditionType.Expression);
FormatCondition fcLc = fcsLc[conditionIndexLc];
Range conditioningRangeLc = workbookDesigner.Workbook.Worksheets[1].Cells.CreateRange("F14", "AB" + (33));
CellArea conditionalAreaLc = new CellArea();
conditionalAreaLc.StartColumn = conditioningRangeLc[dataRowCount, totalflags].Column;
conditionalAreaLc.EndColumn = conditioningRangeLc[dataRowCount, totalflags].Column;
conditionalAreaLc.StartRow = conditioningRangeLc[dataRowCount, totalflags].Row;
conditionalAreaLc.EndRow = conditioningRangeLc[dataRowCount, totalflags].Row;

fcsLc.AddArea(conditionalAreaLc);
fcLc.Formula1 = "=IF(1=1,TRUE,FALSE)";
fcLc.Style.BackgroundColor = Color.Yellow;
Workbook workBook = new Workbook();
workBook.Copy(workbookDesigner.Workbook);
This code was working fine with 5.3.3.0 but with 7.1.0.0 it giving error as mentioned above.
Hi,

Please download and try the latest version: Aspose.Cells for .NET v7.1.1.6

If you still find the issue, kindly create a sample console application with v7.1.1.6, zip it and post it here to show the issue, we will check your issue soon.

Thank you.

I tried with version 7.1.1.6, but the result is the same, getting same error.
The code is same as posted in first post and the formatting conditions are same as given in the code.

Hi,


Well, there are some pointers/variable objects for which I am not sure, also you do use some template Excel file(s), so I cannot evaluate your issue properly. We appreciate if you could kindly create a sample console application with v7.1.1.6 (with your template file(s)), zip it and post it here to reproduce the issue, we will check your issue soon. If we found the issue, we will log it into our database.

Thank you.

Hi

Uploading the template excel file which we are using to generate the report. We are just passing dataset to fill this file with data. Once data is populated, we are invoking the code shared above.
Please let us know what could be the problem and what could be the possible solution for this.

Regards

Hi,


Thanks for sharing us the template file.

We will try to investigate if we could track down the issue. I have logged a ticket for investigation with an id: CELLSNET-40496. We will look into it soon. Once we have any update, we will let you know here.

Thank you.

Hi,


Well, we tried to test your issue with your attached template file with some dummy dataset for the markers, but we still could not find the issue. We appreciate if you could provide us a sample complete runnable project/console application to show the issue. Kindly create and zip the project to attach it here with all the files and details, we will check it soon.

Also, we recommend you to kindly download and use the latest version: Aspose.Cells for .NET v7.1.2.1

Thank you.

Hi

I am uploading simple Console application which can replicate the said issue.

Regards

Hi,

Thanks for providing us your sample project.

We were able to replicate the problem by running your code using the latest version:
Aspose.Cells
for .NET v7.1.2.2



We will look into and once the fix is available, we will update you asap.

Hi,

The issue is caused by the newly conditional formatting is not applied to any range.

Anyway,we will fix this issue soon.

Hi,

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

Hi

I tried with v7.1.2.3 and problem seems to be solved and report is getting generated without any problem.

Can you please tell me when you are going to inclue this version of DLL in official release as current release contains v7.1.2.0 of this DLL.

Hi,


We normally release next official release of the product (Aspose.Cells for .NET) once in a month. You can expect the next official release of the product in the mid of next month.

Moreover, you may use this fix as long as you wish without any problem, it will behave like an official release in your production server. it contains all the full fledged features/functionality of v7.1.2 till current fix. It is an intermediate kind of version which is provided as a fix against some bugs and new features/enhancements. Normally, a bug fix version is posted in the support forums for our clients. Moreover, it is to be noted that our next official release would include all the functionality of the previous fixes (including this one too).

Thank you.

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


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

The new version v7.2.0 of Aspose.Cells is not inculded in Aspose.Total. Is there any specific reason behind that? When you are going to include this new released version of Aspose.Cells in Aspose.Total?

Hi,


No reason at all. In Download module, it normally takes some minutes or a few hours to re-update the Aspose.Total release archives. It is updated now, so you may get the latest version of Aspose.Cells for .NET v7.2.0:
http://www.aspose.com/community/files/51/.net-components/aspose.total-for-.net/entry87871.aspx


May be when you check the Aspose.Total page, it was not updated at that time.

Thank you.

Hi

Aspose.Total now contains v7.2.0 of Aspose.Cells

But there is one big problem. I tried this new release v7.2.0 of Aspose.Cells in my project and is breaking at several places. The reason behind this is, the property "SaveFormat" of class "SaveOptions" is made getter only, setter is removed for this property. I use Wrkbook.Save() function to which I can pass HttpResponse object. This function dont take SaveFormat as parameter. Due to this I cannot use this version of DLL in my code. I find no reason why setter is removed for the property "SaveFormat" of class "SaveOptions".

Please help me to reslove this issue.

Hi,


Yes, I am afraid, you need to update your existing codes a bit. We feel it might not be worth while to provide separate SaveFormat attribute when we already allow to set the SaveFormat in the constructors of the APIs. See the following lines for your reference. You should use SaveOptions APIs’ constructors to specify the SaveFormat accordingly now, you may even skip specifying the SaveFormat in the constructors for some cases too now:
e.g.
var htmOptions = new HtmlSaveOptions(SaveFormat.Html);
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions(SaveFormat.Xlsx);
var saveOptions = new OoxmlSaveOptions(SaveFormat.Xlsm);
PdfSaveOptions saveOption = new PdfSaveOptions(SaveFormat.Pdf);
workbook.Save(HttpContext.Current.Response, “test.xls”, Aspose.Cells.ContentDisposition.Attachment, new XlsSaveOptions(Aspose.Cells.SaveFormat.Excel97To2003));
HttpContext.Current.Response.End();



Thank you.

Hi

I used the new released DLL and applied the changes as suggested by you. After generating report, files (in excel format) got generated properly but for few reports, while opening the file I got this error, “File error: data may have been lost”. I am not sure which other fix in this release is breaking and I cannot use this DLL in my code. Please do let me know when you will fix it and release officially. I am finding it very difficult to get the proper solution in time as I also need to meet my dead line and cannot wait indefinitely.

Hi,


for few reports, while opening the file I got this error, “File error: data may have been lost”.

Could you try our latest fix v7.2.0.1: Aspose.Cells for .NET 7.2.0.1, we fixed a similar issue recently.

If you still find the issue, please create a sample console application, zip it and post it here to show the issue. Also attach your input + output files here. We will check your issue soon.

Thank you.