Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application, both ASP.NET web sites and Windows Forms application.

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