public static TableCellBorder getTableCellBorder(CTBorder border, boolean fromTableCell) { if (border != null) { boolean noBorder = (STBorder.NONE == border.getVal() || STBorder.NIL == border.getVal()); if (noBorder) { return new TableCellBorder(!noBorder, fromTableCell); } Float borderSize = null; BigInteger size = border.getSz(); if (size != null) { // http://officeopenxml.com/WPtableBorders.php // if w:sz="4" => 1/4 points borderSize = size.floatValue() / 8f; } Color borderColor = ColorHelper.getBorderColor(border); return new TableCellBorder(borderSize, borderColor, fromTableCell); } return null; }
public static Color getBorderColor(CTBorder border) { if (border == null) { return null; } // border.getColor returns object???, use attribute w:color to get // the color. Node colorAttr = border.getDomNode().getAttributes().getNamedItemNS(MAIN_NAMESPACE, "color"); if (colorAttr != null) { Object val = border.getVal(); return ColorHelper.getColor(((Attr) colorAttr).getValue(), val, false); } return null; }