PageRenderTime 72ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/src/main/java/com/wcs/tms/view/report/cashpool/util/CashPoolExcelStyle.java

https://github.com/YuanZhencai/tms
Java | 29 lines | 20 code | 6 blank | 3 comment | 0 complexity | bc0fcbb594794dfc80ba472e28c7f321 MD5 | raw file
  1. package com.wcs.tms.view.report.cashpool.util;
  2. import org.apache.poi.hssf.usermodel.HSSFCellStyle;
  3. import org.apache.poi.hssf.usermodel.HSSFFont;
  4. import org.apache.poi.hssf.usermodel.HSSFPalette;
  5. import org.apache.poi.hssf.usermodel.HSSFWorkbook;
  6. public class CashPoolExcelStyle {
  7. private CashPoolExcelStyle() {
  8. }
  9. public static HSSFCellStyle setHeadStyle(HSSFWorkbook workbook, HSSFCellStyle style) {
  10. HSSFPalette palette = workbook.getCustomPalette();
  11. palette.setColorAtIndex((short) 9, (byte) (220), (byte) (240), (byte) (138));
  12. style.setFillForegroundColor((short) 9);
  13. style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
  14. style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
  15. // 生成字体
  16. HSSFFont font = workbook.createFont();
  17. font.setFontHeightInPoints((short) 10);
  18. // font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
  19. // 把字体应用到当前的样样式
  20. style.setFont(font);
  21. return style;
  22. }
  23. }