IExportExcelService.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using NPOI.SS.UserModel;
  2. namespace YBEE.EQM.Application;
  3. /// <summary>
  4. /// EXCEL导出服务
  5. /// </summary>
  6. public interface IExportExcelService
  7. {
  8. /// <summary>
  9. /// 导出 Excel 文件
  10. /// </summary>
  11. /// <typeparam name="T"></typeparam>
  12. /// <param name="input"></param>
  13. /// <returns></returns>
  14. byte[] ExportExcel<T>(ExportExcelDto<T> input);
  15. /// <summary>
  16. /// 获取单元格表头和单元格样式
  17. /// </summary>
  18. /// <param name="wb"></param>
  19. /// <param name="fontSize"></param>
  20. /// <param name="titleFontSize"></param>
  21. /// <returns></returns>
  22. ExportExcelCellStyle GetCellStyle(IWorkbook wb, double fontSize = 10, double titleFontSize = 16);
  23. /// <summary>
  24. /// 添加单元格
  25. /// </summary>
  26. /// <param name="value"></param>
  27. /// <param name="row"></param>
  28. /// <param name="columnIndex"></param>
  29. /// <param name="cellStyle"></param>
  30. /// <param name="sheet"></param>
  31. /// <param name="width"></param>
  32. /// <param name="zeroToBlank">0转为空白</param>
  33. /// <param name="cellType"></param>
  34. ICell AddCell(object value, IRow row, int columnIndex, ICellStyle cellStyle, ISheet sheet = null, int? width = null, bool? zeroToBlank = false, CellType? cellType = null);
  35. }