Reading a date from xlsx using open xml sdk

前端 未结 7 1624
长情又很酷
长情又很酷 2020-12-14 01:25

I have a date in format \"4/5/2011\" (month/day/year) in a xlsx file in one of the cells. Im trying to parse the file and load those data in some classes.

So far the

相关标签:
7条回答
  • 2020-12-14 01:52

    Each cell has 2 properties r (CellReference) and s(StyleIndex)

    StyleIndex for numbers is 2 and for date is 3

    Date it is in ODate and you can convert to string format

    value = DateTime.FromOADate(double.Parse(value)).ToShortDateString();

    0 讨论(0)
提交回复
热议问题