I'm Creating Excel file using ClosedXMl, and want to set alert message on entering Time format other than "HH:MM". I have tried below code but after entering "1" also it's not showing error message but same is working fine for Date format.
ws.Cell("D7").Style.NumberFormat.Format = "hh-mm";
ws.Cell("D7").DataValidation.Time.EqualOrGreaterThan(new TimeSpan(0, 0, 0));
ws.Cell("D7").SetDataValidation().ErrorStyle = XLErrorStyle.Stop;
ws.Cell("D7").SetDataValidation().ErrorMessage = "Date Format HH MM";
code which is working for Date(Alert message get popup aftering entering 1)
ws.Cell("T5").Style.NumberFormat.Format = "dd-mmm-yyyy";
ws.Cell("T5").SetDataValidation().Date.EqualOrGreaterThan(new DateTime(2000, 1, 1));
ws.Cell("T5").SetDataValidation().ErrorStyle = XLErrorStyle.Stop;
ws.Cell("T5").SetDataValidation().ErrorMessage = "Date Format DD MMM YYYY";