Welcome to OpenXML Developer Sign in | Join | Help

Formatting contents of a cell as a date

Last post 09-18-2008, 8:48 AM by jlundstocholm. 1 replies.
Sort Posts: Previous Next
  •  09-18-2008, 6:39 AM 3708

    Formatting contents of a cell as a date

    I am trying to create a SpreadsheetML-file from a database query and I need to store different kinds of data in the columns, herein numbers, strings and dates. I have no problem creating the first two - but I simply cannot figure out how to make the contents of a cell be formatted as a date.

    When I investigate an existing SpreadsheetML-file I can see that the markup looks like this:

    <c r="C1" s="3">
      <
    v>39710</v>
    </c>

    So my question is actually two-fold:

    1. Where do the s="3" point to exactly?

    I have been looking in the spec, and it says that the s-attribute's values is an index into the styles part ... but to what part of it does it refer?

    2. Do I have to write the date as a numeric number and not as a ISO-8601-date ... and if so - how do I most easily convert a date to its numeric equivalent?

    Thanks,

    Jesper
  •  09-18-2008, 8:48 AM 3712 in reply to 3708

    Re: Formatting contents of a cell as a date

    It seems I found the information myself.

    1: I stumpled over this article: http://openxmldeveloper.org/forums/thread/597.aspx from this forum

    2: http://www.csharphelp.com/board2/read.html?f=1&i=39073&t=39073 (DateTime.Now.ToOADate() )
View as RSS news feed in XML