ExportExcelDto.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using NPOI.SS.UserModel;
  2. namespace YBEE.EQM.Application;
  3. /// <summary>
  4. /// 导出 Excel 定义
  5. /// </summary>
  6. public class ExportExcelDto<T>
  7. {
  8. /// <summary>
  9. /// 文件名
  10. /// </summary>
  11. public string FileName { get; set; }
  12. /// <summary>
  13. /// 标题
  14. /// </summary>
  15. public string Title { get; set; }
  16. /// <summary>
  17. /// 标题高度
  18. /// </summary>
  19. public short? TitleHeight { get; set; }
  20. /// <summary>
  21. /// 行高
  22. /// </summary>
  23. public short? RowHeight { get; set; }
  24. /// <summary>
  25. /// 列头高度
  26. /// </summary>
  27. public short? ColumnHeaderHeight { get; set; }
  28. /// <summary>
  29. /// 包含导出时间
  30. /// </summary>
  31. public bool IncludeExportTime { get; set; } = true;
  32. /// <summary>
  33. /// 摘要
  34. /// </summary>
  35. public string Summary { get; set; } = "";
  36. /// <summary>
  37. /// 列定义
  38. /// </summary>
  39. public List<ExportExcelColDto<T>> Columns { get; set; }
  40. /// <summary>
  41. /// 数据行
  42. /// </summary>
  43. public List<T> Items { get; set; }
  44. /// <summary>
  45. /// 自定义概要
  46. /// </summary>
  47. public Func<ISheet, ExportExcelCellStyle, int, int> BuildSummary { get; set; }
  48. /// <summary>
  49. /// 设置Sheet属性
  50. /// </summary>
  51. public Action<ISheet> SetSheet { get; set; }
  52. /// <summary>
  53. /// 字体大小
  54. /// </summary>
  55. public double FontSize { get; set; } = 10;
  56. /// <summary>
  57. /// 标题字体大小
  58. /// </summary>
  59. public double TitleFontSize { get; set; } = 16;
  60. /// <summary>
  61. /// 表头行高
  62. /// </summary>
  63. public short HeaderHeight { get; set; } = ExportExcelCellStyle.DefaultRowHeight;
  64. }