This article explains how to import data from a dynamic collection in XlsIO using C#/VB.NET
How to import dynamic collection?
To import data from a dynamic collection, you need to follow the below steps.
Steps to import dynamic collection:
1. To import data using dynamic object list, the dynamic object should override three methods from System.Dynamic.DynamicObject which are,
2. To get the value for a member, the TryGetMember (GetMemberBinder binder, out object result) method is used.
3. To set the value for a member, the TrySetMember(SetMemberBinder binder, object value) is used.
4. To get the members from the dynamic object GetDynamicMemberNames() method is used.
5. Import the dynamic collection into worksheet.
In this,GetMembersReport() method provides the dynamic collection to be imported into the worksheet.
Note : If XlsIO can’t find these methods then it will not able to import the data in the worksheet which results in throwing an exception.
The below screenshot shows the output after the dynamic object data is imported into the excel file.
|Article ID:||Published Date:||Last Revised Date:||Platform:||Control:|