Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
225
How to load excel with dynamic column collection
posted

Hi,

I am looking to read an excel file into the workbook.

the issue is that the columns in my excel sheet are not certain or pre-defined.

They may vary and I don't want to put any column schema restriction as such.

In the samples you have a observable collection having some pre-defined data members.

Since I don't have control over the number of columns that can be uploaded by the user, I need something which can handle any number of columns. I don't look forward to do any processing on the workbook other than displaying the data on teh screen.

Can someone please suggest on this ?

  • 8421
    Verified Answer
    posted

    Hello,

    Do you have any further questions or concerns about loading a dynamic number of columns from an Excel file?

  • 8421
    Suggested Answer
    posted

    Hello,

    Please see the attached sample for a demonstration of using an IEnumerable collection of IDictionary objects. This data then needs to be converted in to a form that the grid can understand.

    The sample is a modified version of another sample I've created that loads data from an XML file that has a dynamic amount of columns. It uses an extender method to convert the data in to a representation that can be bound to the grid.

    I used the following blog article for the extender method. Please note that this article is neither owned nor maintained by Infragistics:

    <http://blog.bodurov.com/How-to-bind-Silverlight-DataGrid-from-IEnumerable-of-IDictionary>

    Please let me know if you have any further questions or concerns about this approach.

    ExcelDynamicColumns.zip