Пример #1
0
        protected async Task DownloadExcel()
        {
            ShowTitleContextMenu = false;
            byte[] bytes = await GridConfig.DownloadExcel(await GridConfig.GetListAsync(GridSearch));

            string fileName = string.IsNullOrWhiteSpace(GridConfig.ExcelFileName)
                ? $"{GridConfig.GridTitle}{DateTime.Now.Date.ToShortDateString().Replace("/", "-")}.xlsx"
                : GridConfig.ExcelFileName;
            JsHelper jsHelper = new JsHelper();

            ErrorMessage = await jsHelper.DownloadExcelAsync(jSRuntime, bytes, fileName);
        }
Пример #2
0
        protected async Task DownloadSample()
        {
            ShowTitleContextMenu = false;
            ShowUploadSubMenu    = false;
            byte[] bytes = await GridConfig.DownloadExcel(new List <object>());

            string fileName = "Sample_" + (string.IsNullOrWhiteSpace(GridConfig.ExcelFileName)
                ? $"{GridConfig.GridTitle}{DateTime.Now.Date.ToShortDateString().Replace("/", "-")}.xlsx"
                : GridConfig.ExcelFileName);

            JsHelper jsHelper = new JsHelper();

            ErrorMessage = await jsHelper.DownloadExcelAsync(jSRuntime, bytes, fileName);
        }