ExportExcelDto.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. /// 是否XLSX格式
  10. /// </summary>
  11. public bool IsXlsx { get; set; } = true;
  12. /// <summary>
  13. /// 工作表名称
  14. /// </summary>
  15. public string SheetName { get; set; } = "Sheet1";
  16. /// <summary>
  17. /// 文件名
  18. /// </summary>
  19. public string FileName { get; set; }
  20. /// <summary>
  21. /// 标题
  22. /// </summary>
  23. public string Title { get; set; }
  24. /// <summary>
  25. /// 标题高度
  26. /// </summary>
  27. public short? TitleHeight { get; set; }
  28. /// <summary>
  29. /// 行高
  30. /// </summary>
  31. public short? RowHeight { get; set; }
  32. /// <summary>
  33. /// 列头高度
  34. /// </summary>
  35. public short? ColumnHeaderHeight { get; set; }
  36. /// <summary>
  37. /// 包含导出时间
  38. /// </summary>
  39. public bool IncludeExportTime { get; set; } = true;
  40. /// <summary>
  41. /// 摘要
  42. /// </summary>
  43. public string Summary { get; set; } = "";
  44. /// <summary>
  45. /// 列定义
  46. /// </summary>
  47. public List<ExportExcelColDto<T>> Columns { get; set; }
  48. /// <summary>
  49. /// 数据行
  50. /// </summary>
  51. public List<T> Items { get; set; }
  52. /// <summary>
  53. /// 自定义概要
  54. /// </summary>
  55. public Func<ISheet, ExportExcelCellStyle, int, int> BuildSummary { get; set; }
  56. /// <summary>
  57. /// 设置Sheet属性
  58. /// </summary>
  59. public Action<ISheet> SetSheet { get; set; }
  60. /// <summary>
  61. /// 字体大小
  62. /// </summary>
  63. public double FontSize { get; set; } = 10;
  64. /// <summary>
  65. /// 标题字体大小
  66. /// </summary>
  67. public double TitleFontSize { get; set; } = 16;
  68. /// <summary>
  69. /// 表头行高
  70. /// </summary>
  71. public short HeaderHeight { get; set; } = ExportExcelCellStyle.DefaultRowHeight;
  72. /// <summary>
  73. /// 不设置行高
  74. /// </summary>
  75. public bool NotSetRowHeight { get; set; } = false;
  76. }