Hi Syncfusion Team,
I have another query regarding the Gantt chart Excel export feature.
How do I assign columns that I want to include on the Gantt chart Excel export file? By default, the export file will include all the column fields that are defined for the Gantt chart. However, I want to hide fields defined from the Gantt chart to the export file to be generated.
While playing around with the ExportProperties class, I saw this Columns property which to my understanding allows us to define what columns we are including for the Export file. However, the Columns property only accepts a List<GridColumn> value. How can I assign my selected columns to ExportProperties.Columns property.
Here's my code so far...
var exportProperties = new Syncfusion.Blazor.Grids.ExcelExportProperties();
exportProperties.FileName = $"ProjectCalendar_{DateTime.Now.ToString("yyyyMMddhhmmss")}.xlsx";
exportProperties.Columns = ?;
await Gantt.ExportToExcelAsync(exportProperties);
Please advise.
Thanks!
|
public async Task ExportCalendarToExcel()
{
var exportProperties = new Syncfusion.Blazor.Grids.ExcelExportProperties();
exportProperties.FileName = $"ProjectCalendar_{DateTime.Now.ToString("yyyyMMddhhmmss")}.xlsx";
List<GridColumn> ExportColumns = new List<GridColumn>();
ExportColumns.Add(new GridColumn() { Field = "TaskName", HeaderText = "Task Name", Width = "100" });
exportProperties.Columns = ExportColumns;
await Gantt.ExportToExcelAsync(exportProperties);
}
|
Thank you Monisha. This is really helpful. I was able to define the columns that I want to appear on my export file in Excel.
Again, many thanks for your response!