Click here to Skip to main content
15,899,937 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Iam exporting data to excel in that I want to set datatype for few columns in excel for example date, number etc. In c #
Posted
Comments
PIEBALDconsult 7-Nov-15 10:43am    
How are you interacting with Excel? There are many ways and each may have its own way to do that. And some won't allow it at all.
Please use Improve question to add context and detail.

Have you considered simply exporting to CSV?

1 solution

Something like,
C#
Range r = (Excel.Range)worksheetobject.Cells[1,1];
r.EntireColumn.NumberFormat = "MM/DD/YYYY";  // date
r.NumberFormat = "$0.00"; // currency


-KR
 
Share this answer
 
Comments
PIEBALDconsult 7-Nov-15 10:43am    
That assumes he's using a particular toolset which he might not be using.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900