@Override
public String getCssProperty() {
// <w:left w:val="single" w:sz="4"
// w:space="0" w:color="000000" w:themeColor="text1"/>
CTBorder border = (CTBorder)getObject();
if (border==null) return "";
String val = "";
if (border.getVal()!=null) {
STBorder stBorder = border.getVal();
log.debug("border: " + stBorder);
if (stBorder.equals(STBorder.NIL)
|| stBorder == STBorder.NONE) {
val = composeCss(CSS_NAME__STYLE, "none");
} else if (stBorder==STBorder.SINGLE) {
// can use == or .equals
val = composeCss(CSS_NAME__STYLE, "solid");
} else if (stBorder == STBorder.DOUBLE
|| stBorder == STBorder.DOTTED
|| stBorder == STBorder.DASHED
|| stBorder == STBorder.OUTSET
|| stBorder == STBorder.INSET) {
val = composeCss(CSS_NAME__STYLE, stBorder.value() );
} else {
// fallback
log.warn("Falling back to solid");
val = composeCss(CSS_NAME__STYLE, "solid");
}
}
String sz = "";
if (border.getSz()!=null) {
float mm = eighthsToMM(border.getSz().intValue()); // eights of a point
if (mm<0.262) {
// At 96dpi, that's 1 pixel. Anything less WebKit won't display
sz = composeCss(CSS_NAME__WIDTH, "1px" );
} else {
sz = composeCss(CSS_NAME__WIDTH,
UnitsOfMeasurement.format2DP.format(mm) + "mm" );
}
}
String color = "";
// IE8 needs color to be specified. Other browsers don't care.
if (border.getColor()!=null) {
if (border.getColor().equals("auto")) {
color = composeCss(CSS_NAME__COLOR, "#000000" );
} else {
color = composeCss(CSS_NAME__COLOR, "#" + border.getColor() );
}
}
return val + sz + color;
}