use of org.docx4j.wml.STBorder in project Java-Tutorial by gpcodervn.
the class TableBordersTest method testTableBorderStyles.
@Test
public void testTableBorderStyles() throws Docx4JException {
HashMap<String, STBorder> styles = new HashMap<String, STBorder>();
styles.put("none", STBorder.NONE);
styles.put("hidden", STBorder.NONE);
styles.put("solid", STBorder.SINGLE);
styles.put("dotted", STBorder.DOTTED);
styles.put("dashed", STBorder.DASHED);
styles.put("double", STBorder.DOUBLE);
styles.put("inset", STBorder.INSET);
styles.put("outset", STBorder.OUTSET);
// no direct substitution
styles.put("groove", STBorder.SINGLE);
// no direct substitution
styles.put("ridge", STBorder.SINGLE);
styles.put("anyOther", STBorder.NONE);
for (String style : styles.keySet()) {
Tbl tbl = table("<table style='border: 1px " + style + " black;'><tr><td>1</td></tr></table>");
TblBorders borders = tbl.getTblPr().getTblBorders();
assertEquals(styles.get(style), borders.getTop().getVal());
}
}
Aggregations