using System; using System.Linq; using System.Collections.Generic; using System.ComponentModel; using System.ComponentModel.DataAnnotations; namespace MyNamespace { public class MyClass { #region Membervariables and properties [Display( Order = 1 )] public int ID { get; set; } [Display( Order = 2 )] public string FirstName { get; set; } [Display( Order = 3 )] public string LastName { get; set; } [Display( Order = 7 )] public string EmailAddress { get; set; } [Display( Order = 8 )] public string DateCreated { get; set; } #endregion #region Extended properties [Bindable( false )] public Address MainAddress { get; set; } #endregion #region ReadOnly properties [Display( Order = 4 )] public string MainAddressStreet { get { return this.MainAddress.Street; } } [Display( Order = 5 )] public string MainAddressPostCode { get { return this.MainAddress.PostCode; } } [Display( Order = 6 )] public string MainAddressCity { get { return this.MainAddress.City; } } ... #endregion } }
List<MyClass> dataList = ...; worksheet.ImportData( dataList, ... );
Hi Syncfusion Support Team,
I have this same requirement of ordering the data columns, in a specific order.
Any update on the implementation of this feature?
If not implemented yet, Could you prioritize this feature?
Regards,
Sivanesan.S
Hi Sivanesan,
We have logged a feature report as Support for ordering the columns in the Excel based on the values in the Order property but do not have any immediate plans to implement this feature in near future. You can track the status of the feature report through the following feedback link.
Track Status: https://www.syncfusion.com/feedback/37698/support-for-ordering-the-columns-in-the-excel-file-based-on-the-values-in-the
As for now we suggest using the Template marker to order the columns in the Excel. We have prepared the sample for the template marker. kindly try this and let us know if the solution helps.
Sample link -https://www.syncfusion.com/downloads/support/directtrac/general/ze/XlsIO_Sample763589769
Kindly review the following link to know more about the Template marker
https://help.syncfusion.com/file-formats/xlsio/working-with-template-markers
Regards,
Ramya