Export To Excel - Add Extra Columns

Hello, 

Is there a way to include more columns in the datagrid export? I see there is a way to exclude columns. For example, the datagrid has 2 columns a name and a city. I am wondering if there is a way during the export of the 2 column datagrid to add extra columns such as the address and state, so my export would now have 4 columns instead of the original 2. 

Another example is if I want to have an export data added as a column, how would i do that? 

Thank you, 
Dylan

1 Reply

JA Jayaraman Ayyanar Syncfusion Team May 24, 2018 03:26 PM UTC

 
Thanks for contacting Syncfusion support. 
 
We have checked your query for “Exporting the column which is not in the view”. It is not possible to export a column that is not available in the SfDataGrid.Columns collection. However, you can able to work around this requirement from the sample level. If you  do not want to show certain columns when working and want them only when exporting, you can add those columns in the column collection as hidden columns. By this way, the columns hidden will not be shown and you can still export them to Excel or PDF based on your requirement. 
 
Refer the below documentation link for hiding a column. You can also set the width of the column to 0 to hide it.  
 
We have prepared a sample for your requirement and you can download the same from the below link. 
 
Regards, 
Jayaraman. 


Loader.
Up arrow icon