Quantcast
Channel: ClosedXML - The easy way to OpenXML
Viewing all articles
Browse latest Browse all 1877

Closed Unassigned: Cell format to "Date" [9343]

$
0
0

I'm setting the date using the dd/mmm/yy format as below.

ws.Cells[2,4].Style.Numberformat.Format = "dd/mmm/yy";

It works great. But there is only one requirement.
When the end-user opens the workbook and navigates to the cell in question (say: E2), the formatting drop-down in the Number area of the ribbon must say "Date", not "General" or "Custom".

How do I do that?
Comments: That's because Excel doesn't recognize "dd/mmm/yy" as a date format. For example if you use "dd/mm/yy" Excel will interpret it as a custom format. If you use "dd/mm/yy;@" instead then Excel will recognize it as a date format. There's nothing to do other than using one of Excel's date formats if you want it to recognize it as a Date.

Viewing all articles
Browse latest Browse all 1877

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>