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
The output of cell.GetFormattedString() is not correct in the cell with date format with culture specification.
It becomes a serial number (43252 in this case).
Did this work in previous versions of our tool? Which versions?
I recently started using ClosedXML.
I don't know.
Reproducibility
Code to reproduce problem:
staticvoidMain(){varfilename="date.xlsm";// workbookusing(varwb=new ClosedXML.Excel.XLWorkbook( filename )){// First sheetvarsheet= wb.Worksheets.First();foreach(var row in sheet.RowsUsed()){foreach(var cell in row.CellsUsed(true)){
Console.Write( cell.GetFormattedString());
Console.Write("\t");}
Console.WriteLine("");}}}
XLCell.GetFormattedString() internally formats the string according to datatype with ParseCellValueFromString().
The determination of dataType is made with XLWorkbook.GetDataTypeFromFormat(), but if '0' is included in the culture information "[$-409]", it will be wrongly judged as XLDataType.Number.
It can solve by skipping "[$-...]" with XLWorkbook.GetDataTypeFromFormat() as follows.
Do you want to request a feature or report a bug?
Version of ClosedXML
0.93
and
develop branch commit 19f5468
What is the current behavior?
The output of cell.GetFormattedString() is not correct in the cell with date format with culture specification.
It becomes a serial number (43252 in this case).
GetFormat() refers to this page.
What is the expected behavior or new feature?
The date formatted string.
Did this work in previous versions of our tool? Which versions?
I recently started using ClosedXML.
I don't know.
Reproducibility
Code to reproduce problem:
XLCell.GetFormattedString()
internally formats the string according todatatype
withParseCellValueFromString()
.The determination of
dataType
is made withXLWorkbook.GetDataTypeFromFormat()
, but if '0' is included in the culture information "[$-409]", it will be wrongly judged asXLDataType.Number
.It can solve by skipping "[$-...]" with
XLWorkbook.GetDataTypeFromFormat()
as follows./ClosedXML/Excel/XLWorkbook_Load.cs:1923
date.xlsx
The text was updated successfully, but these errors were encountered: