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. Image for the cookie policy date

Remove Columns from Excel Export

Hi,
I'm trying to remove columns from the excel import using exportsettings.Mappings.Remove or RemoveAt, but it seems to be ignoring the command. I can add mappings without issue.

Is there any documentation on this?

Thanks
Michael 

1 Reply

DB Dilli Babu Nandha Gopal Syncfusion Team October 14, 2015 10:07 AM UTC

Hi Michael,

Thank you for contacting Syncfusion support.

We are unable to reproduce the reported issue from our side. You can remove the column in the grid while exporting to excel by using Remove() or RemoveAt() methods of Mapping property in ExcelExportOptions, which is illustrated in below code example.

Code example:

ExcelExportOptions exportSettings = new ExcelExportOptions();

exportSettings.Row = 3;

exportSettings.Column = 2;

exportSettings.Mappings = columnMappings;

// Removes the Column Mapping in the collection

exportSettings.Mappings.Remove(exportSettings.Mappings[2]);

// Removes the Column Mapping at specified index in the collection

exportSettings.Mappings.RemoveAt(2);

using (stream)

{

    ExcelBuilder.Export(this.Books, exportSettings, stream);
}


We have shared the sample for your reference which can be downloaded from following link.
Sample link: http://www.syncfusion.com/downloads/support/forum/120760/ze/BookStoreApplication_20131039436365.zip

Kindly try this sample and let us know whether the issue is resolved. If issue exists then please share us the issue reproducing sample to provide the prompt solution at the earliest.

Regards,
Dilli babu.


Loader.
Live Chat Icon For mobile
Up arrow icon