Esempio n. 1
0
        // public IActionResult Export()
        // {
        //     ();
        //     return Json("");

        //     // return File(
        //     //     fileContents: data,
        //     //     contentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
        //     //     fileDownloadName: excelName
        //     // );

        //     //return File(memory, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", excelName);
        // }

        private async Task <bool> ExportFile(HttpContext context)
        {
            //column header
            var Data_ColumnHeader = new List <SelectListModel_Print_Column_Header>();

            Data_ColumnHeader.Add(new SelectListModel_Print_Column_Header {
                ItemText = "ID"
            });
            Data_ColumnHeader.Add(new SelectListModel_Print_Column_Header {
                ItemText = "Họ tên"
            });
            Data_ColumnHeader.Add(new SelectListModel_Print_Column_Header {
                ItemText = "Tài khoản"
            });
            Data_ColumnHeader.Add(new SelectListModel_Print_Column_Header {
                ItemText = "MK"
            });
            Data_ColumnHeader.Add(new SelectListModel_Print_Column_Header {
                ItemText = "MKSA"
            });
            Data_ColumnHeader.Add(new SelectListModel_Print_Column_Header {
                ItemText = "Là admin"
            });
            Data_ColumnHeader.Add(new SelectListModel_Print_Column_Header {
                ItemText = "Hoạt động"
            });
            Data_ColumnHeader.Add(new SelectListModel_Print_Column_Header {
                ItemText = "Ảnh"
            });

            //
            var printConfig = PrintHelper.Template_Excel_V1(PrintConfig.HeaderType.TwoColumns, "Danh sách người dùng", DateTime.Now, SessionCookieHelper.CurrentUser(this.HttpContext).Result, "Kztek", Data_ColumnHeader, 4, 5, 5);

            //
            var gridmodel = await _SY_UserService.GetPaging("", 1, 10);

            return(await PrintHelper.Excel_Write <SY_User>(context, gridmodel.Data, "User_" + DateTime.Now.ToString("ddMMyyyyHHmmss"), printConfig));
        }