d-mmm-yy
吗?我正在努力将日期格式从ISO-8601格式化为自定义numFmtId=15
单元格。
通过搜索,我发现:
OpenXml and Date format in Excel cell,What do excel xml cell attribute values mean?,What's the difference between <c t="str"> and <c><is> in Office Open XML?使我在理解excel xml方面有了先机。
Microsoft docs 1,它建议<x:xf>
和<cellStyleXfs>
,Microsoft docs2解释关于numFmts (Number Formats)
的问题,但我尚未发现它应该如何在单元格中工作格式。
https://social.msdn.microsoft.com/Forums/office/en-US/c02fc9f9-0a7d-40b5-ac16-48199df474ba/spreadsheet-format-number?forum=oxmlsdk建议您做出两个不同的成就,第二个是您所期望的,然后比较.xml
我发现的唯一区别仅在于建议{{ 1}}
http://www.ericwhite.com/blog/dates-in-strict-spreadsheetml-files/
What indicates an Office Open XML Cell contains a Date/Time value?
我能够检测是否包含styles.xml
关键字的列标题以及内部的任何列值,但是我无法正确设置其格式。
我能在jsreport相关线程上找到的最好的东西是:https://jsreport.net/learn/html-to-xlsx,因为我使用的是numFmtId="15"
食谱,对我没有太大帮助。
您可以在此处看到 playground ,其中包含我到目前为止的进度。
答案 0 :(得分:1)
要格式化单元格,可以在style.xml
上添加:
`<xf numFmtId="15" fontId="0" fillId="0" borderId="1" xfId="0" applyNumberFormat="1" applyFill="1" applyBorder="1" applyAlignment="1">
<alignment horizontal="center" />
</xf>`
并使用该格式更新哪个部分。
例:
<c t="d" s="4">
您可以在 Playground 上查看结果。
我已在问题中链接到的最有用的资源: