This project has moved. For the latest updates, please go here.

Format Problem (challenge) (General/Text)

Sep 18, 2013 at 8:15 AM
Hi Community!

We are using ClosedXML (which is a great library - thx) for a configurable export.

If you open Excel and type in 01.01.2013 the cell is formated as "General".

What we have here is ...
worksheet.Cell("A1").SetValue("01.01.2013");
// RESULT 01.01.2013 (Cell Format = "General")
worksheet.Cell("A2".Value = "01.01.2013";
// RESULT 1012013
Our problem (challenge) is to write the value into Excel without setting the format (like it is done when writing by hand)
Value is formating into "what's possible". Also a filter "01.01.2013..31.01.2013" is formated into an numeric value.

Any suggestions?
Coordinator
Oct 3, 2013 at 4:09 AM
I don't understand the problem. "General" is the default format and you can always specify the format you want.

Note that .SetValue(~) will store the value as it is. .Value = ~ will try to cast it to what it thinks the value is (depending on your locale).