Recently I had chance generating a complex excel file using Apache
POI. I spent a few hours finding formulas.
In this article, I am going to share those formulas. Hope this will helpful for you.
//Convert excel column number to letterimport org.apache.poi.hssf.util.CellReferenceString letter = CellReference.convertNumToColString(ColumnNumber);// Create color using RGB codeimport org.apache.poi.hssf.usermodel.HSSFPalette;HSSFPalette palette = workbook.getCustomPalette();palette.setColorAtIndex(new Byte((byte) 10), new Byte((byte) 22), new Byte((byte) 54), new Byte((byte) 92));//(short index,byte red,byte green, byte blue) - index - the palette index, between 0x8 to 0x40 inclusiveHSSFCellStyle worksheetCellStyle = workbook.createCellStyle();
worksheetCellStyle.setFillForegroundColor(palette.getColor(10).getIndex());
No comments:
Post a Comment