Hi Corazon,
Thanks for contacting Syncfusion support.
Query : I want to remove some columns that are visible in the Grid, so that they do not appear in the exported pdf, excel and word. Is this possible?
We have achieved your requirement by removing the columns from the grid using the Columns property of Grid Properties. In ExportToExcel method we have removed the particular column using RemoveAt method. Please refer the below code example.
public ActionResult ExportToExcel(string GridModel) { ExcelExport exp = new ExcelExport(); var DataSource = _context.Orders.Take(100).ToList(); GridProperties gridProp = ConvertGridObject(GridModel); gridProp.Columns.RemoveAt(3); GridExcelExport excelExp = new GridExcelExport(); excelExp.FileName = "Export.xlsx"; excelExp.Excelversion = ExcelVersion.Excel2010; excelExp.Theme = "flat-saffron"; return exp.Export(gridProp, DataSource, excelExp); } |
We have prepared a sample for your reference. Please refer the below link for the sample.
If you need any further assistance please get back to us.
Regards,
Prasanna Kumar N.S.V