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()); ...
Comments
Post a Comment