This seems silly, but I was not able to get my values ββin the format #/#### to write as a literal string, rather than formatting as a date in excel.
I am using ClosedXML to write to excel and using the following:
// snip IXLRangeRow tableRow = tableRowRange.Row(1); tableRow.Cell(1).DataType = XLCellValues.Text; tableRow.Cell(1).Value = "2/1997"; // snip
Looking at the excel output sheet, I get in cell 2/1/1997 - although I set the format as text in the code, I get it as "Date" on the excel sheet - I checked this by right-clicking on the cell, formatting the cell, view "date" in format.
If I change things to:
// snip IXLRangeRow tableRow = tableRowRange.Row(1); tableRow.Cell(1).Value = "2/1997"; tableRow.Cell(1).DataType = XLCellValues.Text; // snip
Instead, I get 35462 as my output.
I just want my literal value 2/1997 appear on the sheet. Please advise how to fix it.
Kritner
source share