ClosedXML.Report
ClosedXML.Report copied to clipboard
Conditional formatting area extending
I put conditional formatting rules to cell that in named scope (only 1 cell in scope, it's inner horizontal scope) and instead of enlarge affected area to scope (any, not for all parent rows not for inner horizontal columns) it just copied (with overlapping).
It makes generation very slow and if you have just 3 conditions in result file you get 9 in each cells.
Can you send your template and the resulting file? Conditional formatting ranges are merged in sample files. Perhaps I do not understand what you are talking about.
Perhaps ClosedXML (not ClosedXML.Report) merges conditional formatting vertically only, but here horizontal merging is required. It need to ask the guys from ClosedXML about this.
This is a huge issue for us currently! I just need this condition to be expanded like this (AX is 5 in the original) with the generation but instead the condition is copied a lot, and it kills the generation time and the conditional formatting window is freezing.
We need to color cells based on containing value, but it is a hard want, to do this with only the built in conditional formatting in excel itself (without code). But it is a generated area, and it just kills the excel UI if I want to view the formattings (they are cloned) and the generation is way slower because of this.. Any suggestion @b0bi79 ?
@thekokii Try to remove the conditional formatting from the template and add it in the code after the report is generated. Like this:
var template = new XLTemplate(@".\Templates\report.xlsx");
...
template.Generate();
template.Workbook.RangeUsed().AddConditionalFormat().WhenBetween(2, 3)
.Fill.SetBackgroundColor(XLColor.Red);