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: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to change header label when using ExcelEngine ImportData

Thread ID:





132160 Aug 17,2017 11:49 AM UTC Aug 21,2017 09:18 AM UTC ASP.NET Web Forms 3
Tags: XlsIO
Paul Meems
Asked On August 17, 2017 11:49 AM UTC

I have a database table. I read some data using a query and parse it into a list of my dto:

Next, I want to save this data into an Excel-file using:
ExcelEngine() and worksheet.ImportData(data, 1, 1, true)
This works fine.

But I would like to have slightly different header labels.
I know I can change my Dto and my query to change the headers but I want to keep my current Dto and use some kind of attribute:
Current dto declaration:
public string MessageId { get; set; }
Suggested new dto declaration:
[XlsIO.HeaderLabel = "Message number"]
public string MessageId { get; set; }

Of course, ImportData should look at this attribute and use it when available.
Is this possible? If not can it be added to the feature request list?

I'm using v15.3.0.26



Mohan Chandran [Syncfusion]
Replied On August 18, 2017 09:54 AM UTC

Hi Paul, 
Thank you for contacting Syncfusion support. 
Currently, we don’t have a support to get header name from attribute while importing business objects. However, we have logged a feature report and it will be implemented in our upcoming release 2017 Vol 3 SP-1, which is expected to be in the end of August 2017. 
Planned Approach: 
We have planned to use DisplayNameAttribute to get header name. So, we request you to change the attribute in your class as shown below.

Expected Code Snippet:
[DisplayName("Message number")] 
public string MessageId { get; set; } 
Setting such attribute will help you to achieve your requirement. 
NOTE: As of now you can change the header text after importing.  

Please let us know if you have any queries.

Paul Meems
Replied On August 19, 2017 11:44 AM UTC

Thanks for the reply.

The new sp is right on time. I need this functionality in September.

Looking forward to using this new feature.

Sridhar Sukumar [Syncfusion]
Replied On August 21, 2017 09:18 AM UTC

Hi Paul, 
Thank you for updating us. 
Please visit our website periodically for release information.  


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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