XLColumn with MetadataType ? #2603
Unanswered
dbunge-mei
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I was able to add the XLColumn attribute to my C# class, but when I assign the class a MetadataType and move the XLColumn to the MetadataType class, the value from the MetadataType is not put into the table.
I generally use EDMX files with database first, meaning that the data class is generated, so I'm unable to readily add the XLColumn attribute to the class. That's why I tried using the MetadataType.
The following shows how I have the classes that I'm using to populate the table. The output shows "id" and "name" instead of "Id # (Meta)" and "Individual's Name (Meta").
`
protected class TestDataMeta {
[XLColumn(Header = "Id # (Meta)")]
public int id { get; set; }
[XLColumn(Header = "Individual's Name (Meta)")]
public string name { get; set; }
}
`
Code to write to Excel
worksheet.Cell("A1").InsertTable(rptData);
Code that supplies fake data in List
[ReadOnly(true)] private static List<TestData> rptData { get { return new List<TestData>() { new TestData { id = 1, name = "David" }, new TestData { id = 2, name = "Sally" }, new TestData { id = 3, name = "David" }, new TestData { id = 4, name = "Elizabeth" }, new TestData { id = 5, name = "Laura" } }; } }
Any ideas or suggestions for how to show this data with the header values differing would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions