I'm usi开发者_运维百科ng the OpenXML SDK 2.0, and I want to know where the list of defined format styles (and their values) is kept. Specifically, I want to know date/time formats. I want to open an xcel file, read a cell, and try to determine (based on format/style) if it is a date or date time value. Conversely, if I write data to a xcel file, and I want a specific cell to be of a 'Date', what styleindex value do i use?
This article may be of help. It shows how to add style to a cell.
Unfortunately is not possible to reference just the cell format, but you need to reference a cell style item.
I just did a fast look and cannot find the table of standard styles (it's in the xlsx spec somewhere). However, be aware that some of the standard datetime formats are incorrect. Excel does not match what the spec says.
精彩评论