List of usage examples for org.apache.poi.ss.usermodel CellStyle getBorderTop
BorderStyle getBorderTop();
From source file:ru.spb.nicetu.tableviewer.server.XlsToHtml.java
License:Apache License
private void borderStyles(CellStyle style, Formatter out, boolean isBuiltIn) { styleOut("border-left", style.getBorderLeft(), BORDER, out, isBuiltIn); styleOut("border-right", style.getBorderRight(), BORDER, out, isBuiltIn); styleOut("border-top", style.getBorderTop(), BORDER, out, isBuiltIn); styleOut("border-bottom", style.getBorderBottom(), BORDER, out, isBuiltIn); }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.Borders1ReportTest.java
License:Open Source License
private void assertBorder(Sheet sheet, int row, int col, short bottom, short left, short right, short top) { Cell cell = sheet.getRow(row).getCell(col); CellStyle style = cell.getCellStyle(); assertSingleBorder(sheet, row, "bottom", bottom, style.getBorderBottom()); assertSingleBorder(sheet, row, "left", left, style.getBorderLeft()); assertSingleBorder(sheet, row, "right", right, style.getBorderRight()); assertSingleBorder(sheet, row, "top", top, style.getBorderTop()); }
From source file:uk.co.spudsoft.birt.emitters.excel.tests.Borders2ReportTest.java
License:Open Source License
/** * Check that the borders for a given cell match the expected values. * This is complicated by the fact that POI will not always give a particular cell the borders that are seen in Excel * - neighbouring cells may override the values for the chosen cell. * I don't know how to tell which takes precedence, but the following works for the tests I've carried out. *//* ww w. j ava 2s . co m*/ public static void assertBorder(Sheet sheet, int row, int col, short bottom, short left, short right, short top) { Row curRow = sheet.getRow(row); Row prevRow = (row > 0) ? sheet.getRow(row - 1) : null; Row nextRow = sheet.getRow(row + 1); Cell cell = curRow.getCell(col); CellStyle style = cell.getCellStyle(); Cell cellUp = (prevRow == null) ? null : prevRow.getCell(col); Cell cellDown = (nextRow == null) ? null : nextRow.getCell(col); Cell cellLeft = (col == 0) ? null : curRow.getCell(col - 1); Cell cellRight = curRow.getCell(col + 1); CellStyle styleUp = (cellUp == null) ? null : cellUp.getCellStyle(); CellStyle styleDown = (cellDown == null) ? null : cellDown.getCellStyle(); CellStyle styleLeft = (cellLeft == null) ? null : cellLeft.getCellStyle(); CellStyle styleRight = (cellRight == null) ? null : cellRight.getCellStyle(); System.out.println("style == " + style); System.out.println("style == " + style); if ((top != style.getBorderTop()) && ((styleUp == null) || (top != styleUp.getBorderBottom()))) { assertEquals(top, style.getBorderTop()); } if ((bottom != style.getBorderBottom()) && ((styleDown == null) || (bottom != styleDown.getBorderTop()))) { assertEquals(bottom, style.getBorderBottom()); } if ((left != style.getBorderLeft()) && ((styleLeft == null) || (left != styleLeft.getBorderRight()))) { assertEquals(left, style.getBorderLeft()); } if ((right != style.getBorderRight()) && ((styleRight == null) || (right != styleRight.getBorderLeft()))) { assertEquals(right, style.getBorderRight()); } }