Export grid to specific filename with timestamp

Hi,


I want to export a grid to Excel by having a filename plus a datetime stamp (code is listed below). However, the code does not export file. no error is generated.

 


public async Task ToolbarClickHandler(Syncfusion.Blazor.Navigations.ClickEventArgs args)

    {

        if (args.Item.Id == "Grid_excelexport") //Id is combination of Grid's ID and itemname

        {

            string Myfilename = String.Format("Temperature logging {0}.csv",

                               DateTime.UtcNow.ToString("yyyy-MM-dd HH-mm-ss"));


            ExcelExportProperties ExportProperties = new ExcelExportProperties();

            ExportProperties.ExportType = Syncfusion.Blazor.Grids.ExportType.AllPages;

            ExportProperties.FileName = Myfilename; //"Stock_Status.xlsx";

            ExportProperties.IncludeHiddenColumn = true;

            ExportProperties.IncludeTemplateColumn = true;

            await this.GLDefaultGrid.ExportToExcelAsync(ExportProperties);

        }

    }

Best regards


Sao


1 Reply 1 reply marked as answer

NP Naveen Palanivel Syncfusion Team August 22, 2022 04:08 AM UTC

Hi Sao,


Greetings from Syncfusion support.


Query :” Export grid to specific filename with timestamp”


We checked your query by preparing sample for export a grid to Excel by having a filename plus a datetime, but reported issue does not reproduced at our end. We also attached the prepared sample in this ticket for your reference. Kindly share the below details to validate further at our end.


  1. Share us entire Grid code snippet along with model class.
  2. Please ensure to check, Id is set to the grid
  3. Share us the video demonstration of the issue with detailed replication procedure.
  4. If possible share us an simple issue reproduceable sample or try to reproduce the reported issue on the above mentioned sample. 

The above-requested details will be helpful for us to validate the reported query at our end and provide the solution as early as possible.


Regards,

Naveen Palanivel


Attachment: ExcelExport_7a0919e1.zip

Marked as answer
Loader.
Up arrow icon