ConditionalFormattingResult.ConditionalFormattingIcon crashes in certain conditions

Hello:

The following code running against the attached spreadsheet crashes inside the ConditionalFormattingIcon property.

private static void TestConditionalFormatting6()
{
Workbook workbook = new Workbook(@“C:\temp\spreadsheets\TestConditionalFormatting.xlsx”);
Worksheet worksheet = workbook.Worksheets[0];

workbook.CalculateFormula(true);
Cell cell = worksheet.Cells[“A1”];
FormatConditionCollection formatConditions = cell.GetFormatConditions();
ConditionalFormattingResult conditionalFormattingResult = cell.GetConditionalFormattingResult();
ConditionalFormattingIcon icon = conditionalFormattingResult.ConditionalFormattingIcon;
}

I noticed that the crash happens when the StopIfTrue flag is set to true for the format conditions. If you turn them to false it doesn’t crash.

The error is:
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=Aspose.Cells
StackTrace:
at Aspose.Cells.ConditionalFormattingResult.get_ConditionalFormattingIcon()
at TestAspose.Program.TestConditionalFormatting6() in C:\projects\csharp\TestAspose\Program.cs:line 78
at TestAspose.Program.Main(String[] args) in C:\projects\csharp\TestAspose\Program.cs:line 64
InnerException:


Could you please fix this?

Thank you

Hi,


Thanks for the template file and sharing the sample code.

After an initial test, I observed the issue as you mentioned by running your sample code with your template file. It crashes inside the ConditionalFormattingIcon property. I noticed that the crash happens when the StopIfTrue flag is set to true for the format conditions. When I turn it off/false, it doesn’t crash and ConditionalFormattingIcon object is rightly null. I have logged a ticket with an id “CELLSNET-42115” for your issue. We will look into your issue soon.

Once we have any update on it, we will let you know here.

Thank you.


Hi,

Thanks for using Aspose.Cells.

We have fixed this issue.

Please download and try this fix: Aspose.Cells
for .NET v7.6.0.6
.

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


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.