ExportExcelCellStyle.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using NPOI.SS.UserModel;
  2. namespace YBEE.EQM.Application;
  3. /// <summary>
  4. /// 导出单元格样式
  5. /// </summary>
  6. public class ExportExcelCellStyle
  7. {
  8. public IDataFormat DataFormat { get; set; }
  9. /// <summary>
  10. /// 标题字段
  11. /// </summary>
  12. public string TitleFontName { get; set; } = "黑体";
  13. /// <summary>
  14. /// 常规字段
  15. /// </summary>
  16. public string FontName { get; set; } = "宋体";
  17. /// <summary>
  18. /// 百分比
  19. /// </summary>
  20. public ICellStyle PercentCellStyleP2 { get; set; }
  21. /// <summary>
  22. /// 数字两位小数
  23. /// </summary>
  24. public ICellStyle NumberCellStyleP2 { get; set; }
  25. /// <summary>
  26. /// 数字四位小数
  27. /// </summary>
  28. public ICellStyle NumberCellStyleP4 { get; set; }
  29. /// <summary>
  30. /// 标题样式
  31. /// </summary>
  32. public ICellStyle TitleStyle { get; set; }
  33. /// <summary>
  34. /// 摘要样式
  35. /// </summary>
  36. public ICellStyle SummaryStyle { get; set; }
  37. /// <summary>
  38. /// 列头样式
  39. /// </summary>
  40. public ICellStyle ColumnHeaderStyle { get; set; }
  41. /// <summary>
  42. /// 带背景列头样式
  43. /// </summary>
  44. public ICellStyle ColumnFillHeaderStyle { get; set; }
  45. /// <summary>
  46. /// 居中对齐
  47. /// </summary>
  48. public ICellStyle CenterCellStyle { get; set; }
  49. /// <summary>
  50. /// 居左对齐
  51. /// </summary>
  52. public ICellStyle LeftCellStyle { get; set; }
  53. /// <summary>
  54. /// 居右对齐
  55. /// </summary>
  56. public ICellStyle RightCellStyle { get; set; }
  57. /// <summary>
  58. /// 居中对齐(自动换行)
  59. /// </summary>
  60. public ICellStyle CenterWrapCellStyle { get; set; }
  61. /// <summary>
  62. /// 居左对齐(自动换行)
  63. /// </summary>
  64. public ICellStyle LeftWrapCellStyle { get; set; }
  65. /// <summary>
  66. /// 居右对齐(自动换行)
  67. /// </summary>
  68. public ICellStyle RightWrapCellStyle { get; set; }
  69. /// <summary>
  70. /// 填充样式
  71. /// </summary>
  72. public ICellStyle FillCellStyle { get; set; }
  73. /// <summary>
  74. /// 默认标题高度
  75. /// </summary>
  76. public static readonly short DefaultTitleHeight = 50 * 20;
  77. /// <summary>
  78. /// 默认行高
  79. /// </summary>
  80. public static readonly short DefaultRowHeight = 15 * 20;
  81. }