List of usage examples for org.apache.poi.xssf.usermodel XSSFCellStyle setIndention
@Override public void setIndention(short indent)
From source file:net.mcnewfamily.rmcnew.model.excel.CellStyleEssence.java
License:Open Source License
public XSSFCellStyle toXSSFCellStyle(XSSFWorkbook workbook) { if (workbook != null) { XSSFCellStyle xssfCellStyle = workbook.createCellStyle(); xssfCellStyle.setBorderTop(topBorder.toPoiCellStyle()); xssfCellStyle.setBorderBottom(bottomBorder.toPoiCellStyle()); xssfCellStyle.setBorderLeft(leftBorder.toPoiCellStyle()); xssfCellStyle.setBorderRight(rightBorder.toPoiCellStyle()); xssfCellStyle.setAlignment(horizontalAlignment.toPoiCellStyle()); xssfCellStyle.setVerticalAlignment(verticalAlignment.toPoiCellStyle()); xssfCellStyle.setFillPattern(fillPattern.toPoiCellStyle()); // foreground color must be set before background color is set xssfCellStyle.setFillForegroundColor(foregroundColor); xssfCellStyle.setFillBackgroundColor(backgroundColor); xssfCellStyle.setWrapText(this.wrappedText); xssfCellStyle.setIndention(this.indentationInSpaces); if (this.fontEssence != null) { XSSFFont font = fontEssence.toXSSFFont(workbook); xssfCellStyle.setFont(font); }//w w w. jav a2 s . co m return xssfCellStyle; } else { throw new IllegalArgumentException("Cannot create XSSFCellStyle using a null XSSFWorkbook!"); } }
From source file:net.mcnewfamily.rmcnew.shared.Util.java
License:Open Source License
public static void copyXSSFCellStyle(XSSFCell srcCell, XSSFCell destCell) { XSSFCellStyle srcCellStyle = srcCell.getCellStyle(); XSSFCellStyle destCellStyle = destCell.getCellStyle(); // destCellStyle.cloneStyleFrom(srcCellStyle); destCellStyle.setAlignment(srcCellStyle.getAlignment()); destCellStyle.setVerticalAlignment(srcCellStyle.getVerticalAlignment()); destCellStyle.setFont(srcCellStyle.getFont()); destCellStyle.setBorderBottom(srcCellStyle.getBorderBottom()); destCellStyle.setBorderLeft(srcCellStyle.getBorderLeft()); destCellStyle.setBorderRight(srcCellStyle.getBorderRight()); destCellStyle.setBorderTop(srcCellStyle.getBorderTop()); destCellStyle.setFillPattern(srcCellStyle.getFillPattern()); // foreground color must be set before background color is set destCellStyle.setFillForegroundColor(srcCellStyle.getFillForegroundColor()); destCellStyle.setFillBackgroundColor(srcCellStyle.getFillBackgroundColor()); destCellStyle.setIndention(srcCellStyle.getIndention()); destCellStyle.setWrapText(srcCellStyle.getWrapText()); destCell.setCellStyle(destCellStyle); }