Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6809769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:07:31+00:00 2026-05-26T20:07:31+00:00

I have a model like this: public class Instrument { public string Id {

  • 0

I have a model like this:

public class Instrument
{
    public string Id { get; set; }
    public string Name { get; set; }

    // About 100 other properties
}

And I retrieve Instrument instances from an Entity Framework EDM.

Now what I would like to do is to be able to make a custom mapping to bind this dataset to a Excel ListObject. By default, ListObject will display every column in the Excel worksheet but I only want to show some properties and in a particular order.

ExcelTools.ListObject instrumentsTable = this.Controls.AddListObject(tableStart, tableName);
instrumentsTable.DataSource = myEDM.Instruments;

// Custom mapping code...

I tried to use the SetDataBinding method but it was throwing a data binding exception.

Do anybody can help me achieving that?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T20:07:32+00:00Added an answer on May 26, 2026 at 8:07 pm

    I don’t know if this is helpful, but I created a test project doing this. The test project runs without problems.

    First, I declare a test class:

    public class Instrument
    {
        public string Id { get; set; }
        public string Name { get; set; }
        public string Property1 { get; set; }
        public string Property2 { get; set; }
    
    }
    

    I have a function getInstruments, that returns a List.

    Then I bind this to a sheet using this code:

            List<Instrument> list = getInstruments();
            ListObject instrumentsTable = Controls.AddListObject(Range["A1", "B4"], "list1");
            string[] mappedColumns = { "Name", "Property1" };
            instrumentsTable.SetDataBinding(list, string.Empty, mappedColumns);
    

    This displays a sheet with 4 instruments showing Name and Property1 in columns A and B.

    I also tried this using Entity framework, connecting the sheet to one of my databases and didn’t run into any problems with that either.

    If you are still having problems, please give more information about the exception you get when using SetDataBinding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an object model like this: public class MyClass { int TheProp {get;set;}
I have a model that looks like this: public class Book { public string
Lets say I have a set of model classes like this: public class Person
I have an object model somewhat like this: public class MyObject { public string
I have a simple model like this one: class Artist(models.Model): surname = models.CharField(max_length=200) name
I have a model like this: public PurchaseOrder { [Required] [StringLength(15)] public virtual string
Well i have a complex form view model like this : public class TransactionFormViewModel
I have a object model a bit like this: public class Foo { public
I have a view model like this: public class EditVM { public Media.Domain.Entities.Movie Movie
I have a view model that looks like this: public class VenueIndexViewModel : BaseViewModel

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.