private CTLineProperties getCTLine(BorderEdge edge, boolean create) { if (edge == null) { throw new IllegalArgumentException("BorderEdge needs to be specified."); } CTTableCellProperties pr = getCellProperties(create); if (pr == null) { return null; } switch (edge) { case bottom: return (pr.isSetLnB()) ? pr.getLnB() : (create ? pr.addNewLnB() : null); case left: return (pr.isSetLnL()) ? pr.getLnL() : (create ? pr.addNewLnL() : null); case top: return (pr.isSetLnT()) ? pr.getLnT() : (create ? pr.addNewLnT() : null); case right: return (pr.isSetLnR()) ? pr.getLnR() : (create ? pr.addNewLnR() : null); default: return null; } }
/** * Specifies a solid color fill. The shape is filled entirely with the * specified color. * * @param color * the solid color fill. The value of <code>null</code> unsets * the solidFIll attribute from the underlying xml */ @Override public void setFillColor(Color color) { CTTableCellProperties spPr = getCellProperties(true); if (color == null) { if (spPr.isSetSolidFill()) { spPr.unsetSolidFill(); } } else { CTSolidColorFillProperties fill = spPr.isSetSolidFill() ? spPr.getSolidFill() : spPr.addNewSolidFill(); XSLFColor c = new XSLFColor(fill, getSheet().getTheme(), fill.getSchemeClr()); c.setColor(color); } }
@Override public VerticalAlignment getVerticalAlignment() { CTTableCellProperties cellProps = getCellProperties(false); VerticalAlignment align = VerticalAlignment.TOP; if (cellProps != null && cellProps.isSetAnchor()) { int ival = cellProps.getAnchor().intValue(); align = VerticalAlignment.values()[ival - 1]; } return align; }
@Override public CTSolidColorFillProperties addNewSolidFill() { return props.addNewSolidFill(); }
public Color getBorderTopColor(){ return getLineColor(getXmlObject().getTcPr().getLnT()); }
public Color getBorderBottomColor(){ return getLineColor(getXmlObject().getTcPr().getLnB()); }
public Color getBorderLeftColor(){ return getLineColor(getXmlObject().getTcPr().getLnL()); }
public Color getBorderRightColor(){ return getLineColor(getXmlObject().getTcPr().getLnR()); }
@Override public CTSolidColorFillProperties addNewSolidFill() { return props.addNewSolidFill(); }
public double getBorderTop(){ CTTableCellProperties pr = getXmlObject().getTcPr(); CTLineProperties ln = pr.getLnT(); return ln == null || !ln.isSetW() ? defaultBorderWidth : Units.toPoints(ln.getW()); }