I would like to generate an excel sheet aout of a table in asp. The exporting works fine using an in-开发者_Go百科house developed framework to export the table. The problem that I'm having is that dates are just written in columns as strings and not initialized with the proper cell format. Is there any way to format the date without any 3rd party software by just setting the value of a cell with a string?? Such as:
sheet[i,j].Value = "{:DateTime}"+dateStringProperlyFormatted
I'm not in front of an appropriate box to test this at the moment, but you should be able to format the range with something like:
rangeOfInterest.NumberFormat = "MM/DD/YYYY"
The range could be your single cell, or whatever you'd like. You could also do the entire row with:
rangeOfInterest.EntireColumn.NumberFormat = "MM/DD/YYYY"
There's probably an :"EntreRow" version too, although I don't recall having ever used it.
精彩评论