Exporting to excel from a custom class object using C#.NET
We may face a scenario to export the data of custom class object to excel using InterOp .You can get the property name's from the class object using Reflection.Create a work sheet header by reading the each propety of the class object.I have created a separate method to get the all properties into a list collection of string as given below /// /// Get the list of Properties Name into a list collection. /// /// /// public List GetPropeties(Employee objEmployee) { Type myType = objEmployee.GetType(); IList props = new List (myType.GetProperties()); ...
very nice article and straight to the point .
ReplyDeletei would just like to have an example that uses List and returns the data as JSON to the client.
it would be nice to have a WCF or usual WEbservice for this implementation.
Thanks for sharing this nice code
Maher
You are welcome Maher. Bookmark this link to get updates :-)
ReplyDelete