SpreadsheetDocument document;
document = SpreadsheetDocument.newSpreadsheetDocument();
Table table1 = document.getTableByName("Sheet1");
Cell cell1 = table1.getCellByPosition("A1");
cell1.setStringValue("four border");
Border border = new Border(Color.RED, 1, StyleTypeDefinitions.SupportedLinearMeasure.PT);
cell1.setBorders(CellBordersType.ALL_FOUR, border);
Border bottomBorder = cell1.getStyleHandler().getBorder(CellBordersType.BOTTOM);
Assert.assertEquals(border, bottomBorder);
Cell cell2 = table1.getCellByPosition("C2");
cell2.setStringValue("top bottom");
Border border2 = new Border(Color.BLUE, 5, 1, 2, StyleTypeDefinitions.SupportedLinearMeasure.PT);
cell2.setBorders(CellBordersType.TOP_BOTTOM, border2);
Border bottomBorder2 = cell2.getStyleHandler().getBorder(CellBordersType.BOTTOM);
Assert.assertEquals(border2, bottomBorder2);
Border bottomBorder22 = cell2.getStyleHandler().getBorder(CellBordersType.LEFT);
Assert.assertEquals(Border.NONE, bottomBorder22);
document.save(ResourceUtilities.newTestOutputFile("TestSetGetBorder.ods"));
} catch (Exception e) {
Logger.getLogger(TableCellTest.class.getName()).log(Level.SEVERE, e.getMessage(), e);
Assert.fail();