List of usage examples for org.apache.poi.xssf.usermodel XSSFCellStyle getBorderLeft
@Override
public BorderStyle getBorderLeft()
From source file:de.escnet.ExcelTable.java
License:Open Source License
private void styleBorders(Map<String, String> styles, int rowIndex, int colIndex, Span span) { XSSFCell cell = getCell(rowIndex, colIndex); XSSFCellStyle cellStyle = cell.getCellStyle(); if (cellStyle != null) { int topThickness = 0; if (rowIndex > rowMin) { XSSFCell topCell = getCell(rowIndex - 1, colIndex); if (topCell != null) { XSSFCellStyle topCellStyle = topCell.getCellStyle(); if (topCellStyle != null) { topThickness = getThickness(topCellStyle.getBorderBottom()); }//from w ww.j a va 2 s . co m } } styleBorder(styles, "top", cellStyle.getBorderTop(), topThickness, cellStyle.getTopBorderColor()); int leftThickness = 0; if (colIndex > colMin) { XSSFCell leftCell = getCell(rowIndex, colIndex - 1); if (leftCell != null) { XSSFCellStyle leftCellStyle = leftCell.getCellStyle(); if (leftCellStyle != null) { leftThickness = getThickness(leftCellStyle.getBorderRight()); } } } styleBorder(styles, "left", cellStyle.getBorderLeft(), leftThickness, cellStyle.getLeftBorderColor()); } cell = getCell(rowIndex + span.rowspan - 1, colIndex); cellStyle = cell.getCellStyle(); if (cellStyle != null) { styleBorder(styles, "bottom", cellStyle.getBorderBottom(), 0, cellStyle.getBottomBorderColor()); } cell = getCell(rowIndex, colIndex + span.colspan - 1); cellStyle = cell.getCellStyle(); if (cellStyle != null) { styleBorder(styles, "right", cellStyle.getBorderRight(), 0, cellStyle.getRightBorderColor()); } }
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); }