728x90
반응형

poi 를 이용하여 excel 파일 쓰는데 컬럼헤더에는 색을 주고 싶은데...

 

setFillBackgroundColor 속성으로 아무리 속성값을 줘도 색이 변하지 않더니..

 

 

          Workbook workbook = null;

          WorkbookFactory.create(new FileInputStream(fileName));

 

          // 폰트속성

           Font fontBLACK = this.workbook.createFont();
           fontBLACK.setColor(HSSFColor.BLACK.index);

 

          

            // 셀속성 

 CellStyle center = this.workbook.createCellStyle();
 center.setAlignment(CellStyle.ALIGN_CENTER);                         ==> 정렬
 center.setVerticalAlignment(CellStyle.VERTICAL_TOP);
 center.setFont(fontBLACK);                                                     ==> 폰트
 center.setBorderTop(CellStyle.BORDER_THIN);                          ==> 테두리 설정
 center.setBorderLeft(CellStyle.BORDER_THIN);
 center.setBorderRight(CellStyle.BORDER_THIN);
 center.setBorderBottom(CellStyle.BORDER_THIN);
  // center.setFillBackgroundColor(HSSFColor.SKY_BLUE.index);  ==> 적용안됨  - - ;;;
  
  center.setFillForegroundColor(HSSFColor.SKY_BLUE.index)
  center.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);

 

* setFillForegroundColor ​속성만 해줘서는 안되고 setFillPattern SOLID_FOREGROUND 속성을 지정해줘야한다..

 

728x90
반응형

'JAVA > EXCEL컨트롤관련' 카테고리의 다른 글

POI Excel 파일 쓰기  (0) 2015.10.22
width  (0) 2015.09.04
셀 합치기  (0) 2015.09.04
Excel - POI  (0) 2015.03.09
poi를 사용한 엑셀 생성  (0) 2014.11.27
[JAVA] 자바에서 엑셀을 만들자 : Apache POI  (0) 2014.11.27
POI - Excel Read/Write(xls, xlsx) sample  (0) 2014.11.27
xbeans 관련오류수정  (0) 2014.11.17
블로그 이미지

nineDeveloper

안녕하세요 현직 개발자 입니다 ~ 빠르게 변화하는 세상에 뒤쳐지지 않도록 우리모두 열심히 공부합시다 ~! 개발공부는 넘나 재미있는 것~!

,