Excel XML, how can I get Excel to display my DateTime field in yyyy-MM-dd format?

前端 未结 1 1277
别跟我提以往
别跟我提以往 2020-12-20 21:47

I generate an XML file through C#, and the relevent part looks like this


    2009-01-18T00:00:00.000

        
相关标签:
1条回答
  • 2020-12-20 22:18

    In the <Styles> section add

      <Style ss:ID="s22">
       <NumberFormat ss:Format="yyyy\-mm\-dd"/>
      </Style>
    

    then mark your cell with the style:

    <Cell ss:StyleID="s22"><Data ss:Type="DateTime">2009-01-21T00:00:00.000</Data></Cell>
    

    Alternatively, open your XML file in Excel, make the change you want, re-save it as XML, then look to see what changed.

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