Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Thu Oct 21, 2010 8:42 am

Hello!

How can i set the excel column format? For example from default to datetime, or specific datetime format: "dd.mm.yyyy hh:mm".

Thanks

dfense
 
Posts: 12
Joined: Tue Jan 20, 2009 2:35 pm
Location: Frankfurt, Germany

Thu Oct 21, 2010 1:32 pm

Hello,

Thank you for your inquiry.
Please try to use following code to set column format.

Code: Select all
          sheet.Range["A1"].DateTimeValue = DateTime.Now;
          sheet.Columns[0].NumberFormat = "dd.mm.yyyy hh:mm";

Please let me know if you have any questions and concerns.

Best Regards.
User avatar

Flash
 
Posts: 56
Joined: Thu Jun 29, 2006 2:34 pm

Thu Oct 21, 2010 1:53 pm

Great! It works very well. Thank you for support.

Best wishes.

dfense
 
Posts: 12
Joined: Tue Jan 20, 2009 2:35 pm
Location: Frankfurt, Germany

Return to Spire.XLS