We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to import data from dynamic collection using XlsIO?

Platform: WinForms |
Control: XlsIO |
Published Date: February 28, 2018 |
Last Revised Date: February 28, 2018
Tags: xlsio

This article explains how to import data from a dynamic collection in XlsIO using C#/VB.NET


How to import dynamic collection?


XlsIO provides the support to import data into a worksheet from data table, array and business objects.The data source can be a dynamic object 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,


  • TryGetMember(GetMemberBinder binder, out object result),
  • TrySetMember(SetMemberBinder binder, object value) and
  • GetDynamicMemberNames().


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.


To know more about importing data from various sources using XlsIO, please refer the documentation.


Download Complete Sample

The following C#/VB.NET complete code snippet shows how to import data from a dynamic collection.




The below screenshot shows the output after the dynamic object data is imported into the excel file.



2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon