ExcelExportService.cs 746 B

12345678910111213141516171819202122232425262728
  1. using DllEapCommon.NPOI;
  2. using NPOI.SS.UserModel;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace DllEapBll.Services
  8. {
  9. /// <summary>
  10. /// 导出数据类
  11. /// </summary>
  12. public class ExcelExportService
  13. {
  14. /// <summary>
  15. /// 导出到Excel
  16. /// </summary>
  17. /// <typeparam name="T"></typeparam>
  18. /// <param name="entities"></param>
  19. /// <returns></returns>
  20. public async Task<IWorkbook> ExportExcel<T>(List<T> entities) where T : class, new()
  21. {
  22. var exportHelper = DataExportHelper.EntityToExcel<T>(entities);
  23. await Task.CompletedTask;
  24. return exportHelper;
  25. }
  26. }
  27. }