You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using ClosedXML.Report;
var data = new
{
Directors = new[]
{
new { Director = "Steven Spielberg", Movie = "Jaws" },
new { Director = "Quentin Tarantino", Movie = "Pulp Fiction" },
new { Director = "Steven Spielberg", Movie = "E.T." },
new { Director = "Quentin Tarantino", Movie = "" },
new { Director = "Steven Spielberg", Movie = "Jurassic Park" },
new { Director = "Quentin Tarantino", Movie = "" },
new { Director = "Steven Spielberg", Movie = "Indiana Jones" },
},
Genres = new[]
{
new { Movie = "Jaws", Genre = "Thriller" },
new { Movie = "Pulp Fiction", Genre = "" },
new { Movie = "E.T.", Genre = "Sci-Fi" },
new { Movie = "Kill Bill", Genre = "" },
new { Movie = "Jurassic Park", Genre = "Sci-Fi" },
new { Movie = "Reservoir Dogs", Genre = "Thriller" },
new { Movie = "Indiana Jones", Genre = "" },
new { Movie = "E.T.", Genre = "Family" },
new { Movie = "Jaws", Genre = "Horror" },
},
Actors = new[]
{
new { Movie = "Jaws", Actor = "Roy Scheider" },
new { Movie = "Pulp Fiction", Actor = "John Travolta" },
new { Movie = "E.T.", Actor = "" },
new { Movie = "E.T.", Actor = "Henry Thomas" },
new { Movie = "Kill Bill", Actor = "" }
},
};
void GenerateWithClosedXML()
{
const string outputFile = "./output.xlsx";
var template = new XLTemplate(@"./repro-template-broken.xlsx");
// var template = new XLTemplate(@"./repro-template-working.xlsx");
template.AddVariable(data);
template.Generate();
template.SaveAs(outputFile);
}
GenerateWithClosedXML();
Repro steps:
Run attached code
Observe conditional formatting is applied in wrong place
Results:
Template should color the cell in red if value is empty:
However after generating the output conditional formatting breaks for the second table:
Note: if the gap between tables is more than 4 lines conditional formatting is applied correctly (as seen in repro-template-working.xlsx)
The text was updated successfully, but these errors were encountered:
It seems that 4 lines rule mentioned by @pledominykas is a random glitch. What I've found is that if I have two tables and the upper grows by 15 rows, conditional formatting is applied starting with 15th row of the lower table. I have conditional formatting in the second table only.
Looks like a bug in the conditional formatting propagation logic.
Conditional formatting breaks when used inside template with multiple tables one after the other.
Template broken:
repro-template-broken.xlsx
Template working:
repro-template-working.xlsx
Code:
Repro steps:
Results:

Template should color the cell in red if value is empty:
However after generating the output conditional formatting breaks for the second table:

Note: if the gap between tables is more than 4 lines conditional formatting is applied correctly (as seen in repro-template-working.xlsx)
The text was updated successfully, but these errors were encountered: