Posted 4 October 2021, 6:35 am EST
In Spread.NET 14, in an ASP.NET MVC 5 environment, we have found strange behavior in a very specific scenario with conditional formatting and adding rows.
Let’s first consider two scenarios that do behave as expected:
Scenario 1: new spread instance
Start from a new spread instance.
Set a conditional formatting rule to a cell using SheetView.SetConditionalFormatting, e.g. row = 1, col = 1, rowcount = 1, colcount = 1.
Add rows using SheetView.AddRows, e.g. with arguments row = 1, rowcount = 10.
Result: the earlier assigned conditional formatting rule (as found in SheetView.ConditionalFormatting) gets a new cellrange: row = 11, col = 1, rowcount = 1, colcount = 1.
Scenario 2: spread instance loaded from an xml
Start from a new spread instance.
Set a conditional formatting rule to a cell using SheetView.SetConditionalFormatting, e.g. row = 1, col = 1, rowcount = 1, colcount = 1.
Save the entire spread instance to xml.
Start from a new spread instance.
Load the saved xml into the spread instance.
Add rows using SheetView.AddRows, e.g. with arguments row = 1, rowcount = 10.
Result: the earlier assigned conditional formattin rule (as found in SheetView.ConditionalFormatting) gets a new cellrange: row = 11, col = 1, rowcount = 1, colcount = 1.
The next scenario does behave differently:
Scenario 3: individual sheetview loaded from xml
Start from a new spread instance.
Set a conditional formatting rule to a cell using SheetView.SetConditionalFormatting, e.g. row = 1, col = 1, rowcount = 1, colcount = 1.
Save the active sheetview to xml.
Start from a new spread instance.
Load the saved xml into the active sheetview.
Add rows using SheetView.AddRows, e.g. with arguments row = 1, rowcount = 10.
Result: the earlier assigned conditional formattin rule (as found in SheetView.ConditionalFormatting) gets a new cellrange: row = 1, col = 1, rowcount = 10, colcount = 1.
What is the reason for the 3rd scenario to result in a modified rowcount, instead of row?
We would need this scenario to behave the same way as 1 and 2.
Thanks in advance for your help.