ExportExcelDto.cs 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. }