0
我想使用POI着色特定单元格和Shade it
。
正常情况下,要选中单元格,可以选择单元格 - >右键单击 - >格式单元格 - >填充(选项卡) - >填充效果,选择颜色并选择阴影样式(对于我来说,它将是金色和阴影样式作为HORIZONTAL第二选项)。
我面临的问题是,我无法找到帮助遮蔽细胞的功能。这甚至有可能使用POI或甚至jxl?这里是我的代码片段:使用Apache POI的着色单元格
FileOutputStream fileOut = new FileOutputStream("C:/poi-test.xls");
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet worksheet = workbook.createSheet("POI Worksheet");
HSSFRow row1 = worksheet.createRow((short) 0);
HSSFCell cellA1 = row1.createCell((short) 0);
cellA1.setCellValue("Hello");
HSSFCellStyle cellStyle = workbook.createCellStyle();
cellStyle.setFillForegroundColor(HSSFColor.GOLD.index);
cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);\\ this part is probably redundant
cellA1.setCellStyle(cellStyle);
workbook.write(fileOut);
fileOut.close();