ClosedXML / ClosedXML/ClosedXML.Report
Date Format is not applied until manually entering Cell when using DateOnly
- Dominant language
- C#
- Stars
- 647
- Forks
- 122
- PR merge metrics
- No merged PRs in 30d
Description

I often had it that the custom Format did not get applied to ClosedXML.Report outputs and I always had to manually enter cells for them to apply. Even default Date Formats were not applied unitl you entered the Cell. I made a Sample which shows the behaviour in ClosedXML.Report 0.2.12-rc, (also behaved the same in old 0.2.2). I only have one Template where I got it working without manually doing so, but I was not able to replicate it.
```csharp
// FormattingTest
// Bug Date Format not working: [$-de-DE]TTT, TT
var table5 = new List
{
new("TestName6", new DateOnly(2025, 3, 23)),
new("TestName7", new DateOnly(2025, 3, 24)),
new("TestName8", new DateOnly(2025, 3, 25)),
new("TestName9", new DateOnly(2025, 3, 26))
};
template.AddVariable("FormattingTest", table5);
template.Generate();
template.SaveAs(outputFile);
private record FormattingTestEntry(
string Name,
DateOnly Date
);
```
[FormattingTest.xlsx](https://github.com/user-attachments/files/19320620/FormattingTest.xlsx)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.