Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Created Unassigned: Shifted conditional formating colors after the sheet is overwritten or new sheet is added. [9406]

$
0
0
Hi,

great library, thank you!

I found a bug in conditional formating. I am filling cells in range with conditional formating setting the background colors by the content. This is the only part of my code that uses conditional format:

rangeDays.AddConditionalFormat().WhenStartsWith("D")
.Fill.SetBackgroundColor(XLColor.Red);
rangeDays.AddConditionalFormat().WhenStartsWith("p")
.Fill.SetBackgroundColor(XLColor.Cerise);
rangeDays.AddConditionalFormat().WhenStartsWith("N")
.Fill.SetBackgroundColor(XLColor.Yellow);
rangeDays.AddConditionalFormat().WhenStartsWith("S")
.Fill.SetBackgroundColor(XLColor.FromHtml("#9999FF"));
rangeDays.AddConditionalFormat().WhenStartsWith("§")
.Fill.SetBackgroundColor(XLColor.GreenYellow);

When I save a newly created excel it works fine. But If my code modifies already existing excel either by deleting the same named sheet and created a new one or by adding a new sheet which is filled in the same way as the previous one was then the conditional formating colors are shifted in this way:
D - #9999FF
p - GreenYellow
N - Red
S - Cerise
§ - Yellow
The palette looks shifted by 2.

If I do it one more time and add third sheet it gets even weirder:
conditional formating is shifted again, now more randomly, some are shifted from the previous step, some are not:
D - Cerise
p - GreenYellow
N - Red
S - Yellow
§ - #9999FF

And the weirdest part, the cells whose color is not set at all are now red

Viewing all articles
Browse latest Browse all 1877

Latest Images

Trending Articles



Latest Images