1 2 17 18 19 package org.apache.poi.hssf.usermodel.examples; 20 21 import org.apache.poi.hssf.usermodel.*; 22 import org.apache.poi.hssf.util.HSSFColor; 23 24 import java.io.FileOutputStream ; 25 import java.io.IOException ; 26 27 32 public class FrillsAndFills 33 { 34 public static void main(String [] args) 35 throws IOException 36 { 37 HSSFWorkbook wb = new HSSFWorkbook(); 38 HSSFSheet sheet = wb.createSheet("new sheet"); 39 40 HSSFRow row = sheet.createRow((short) 1); 42 43 HSSFCellStyle style = wb.createCellStyle(); 45 style.setFillBackgroundColor(HSSFColor.AQUA.index); 46 style.setFillPattern(HSSFCellStyle.BIG_SPOTS); 47 HSSFCell cell = row.createCell((short) 1); 48 cell.setCellValue("X"); 49 cell.setCellStyle(style); 50 51 style = wb.createCellStyle(); 53 style.setFillForegroundColor(HSSFColor.ORANGE.index); 54 style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); 55 cell = row.createCell((short) 2); 56 cell.setCellValue("X"); 57 cell.setCellStyle(style); 58 59 FileOutputStream fileOut = new FileOutputStream ("workbook.xls"); 61 wb.write(fileOut); 62 fileOut.close(); 63 } 64 } 65 | Popular Tags |