-
Notifications
You must be signed in to change notification settings - Fork 808
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting format exception and not getting proper value of a cell which shows properly on excel #113
Comments
ClosedXML won't be able to evaluate a custom format like that. I suggest changing the format to something more standard before trying to retrieve the value. |
thanks for the reply I changed the format to a standard date format and still throwing the same error....is there another lib you suggest for this kind of issues. thank you |
If you can attach your spreadsheet, I can have a look at the problem. |
Book1.xlsx |
Using the latest code from the private static void Main(string[] args)
{
using (var wb = new XLWorkbook("test.xlsx"))
{
var ws = wb.Worksheets.First();
var cell = ws.Cell("B11");
cell.Style.NumberFormat.SetFormat("yyyy-MM-dd");
cell.DataType = XLCellValues.DateTime;
Console.WriteLine(cell.Value);
}
Console.WriteLine("Press any key to continue");
Console.ReadKey();
} |
ok Thank you I will clone and test. |
I am getting a
'((ClosedXML.Excel.XLCell)timeCell).Value' threw an exception of type 'System.FormatException'
when trying to access the value of a cell which contains a date with a custom format of[$-en-US]dddd, mm/dd
.Appreciate all the help.
The text was updated successfully, but these errors were encountered: