IExportExcelService.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. void AddCell(object value, IRow row, int columnIndex, ICellStyle cellStyle, ISheet sheet = null, int? width = 8);
  33. }