use of org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType in project poi by apache.
the class TestXWPFTable method testSetGetVBorders.
public void testSetGetVBorders() {
// create a table
XWPFDocument doc = new XWPFDocument();
CTTbl ctTable = CTTbl.Factory.newInstance();
XWPFTable table = new XWPFTable(ctTable, doc);
// set inside vertical border
table.setInsideVBorder(XWPFBorderType.DOUBLE, 4, 0, "00FF00");
// get inside vertical border components
XWPFBorderType bt = table.getInsideVBorderType();
assertEquals(XWPFBorderType.DOUBLE, bt);
int sz = table.getInsideVBorderSize();
assertEquals(4, sz);
int sp = table.getInsideVBorderSpace();
assertEquals(0, sp);
String clr = table.getInsideVBorderColor();
assertEquals("00FF00", clr);
}
use of org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType in project poi by apache.
the class TestXWPFTable method testSetGetHBorders.
public void testSetGetHBorders() {
// instantiate the following classes so they'll get picked up by
// the XmlBean process and added to the jar file. they are required
// for the following XWPFTable methods.
CTTblBorders cttb = CTTblBorders.Factory.newInstance();
assertNotNull(cttb);
STBorder stb = STBorder.Factory.newInstance();
assertNotNull(stb);
// create a table
XWPFDocument doc = new XWPFDocument();
CTTbl ctTable = CTTbl.Factory.newInstance();
XWPFTable table = new XWPFTable(ctTable, doc);
// set inside horizontal border
table.setInsideHBorder(XWPFBorderType.SINGLE, 4, 0, "FF0000");
// get inside horizontal border components
int s = table.getInsideHBorderSize();
assertEquals(4, s);
int sp = table.getInsideHBorderSpace();
assertEquals(0, sp);
String clr = table.getInsideHBorderColor();
assertEquals("FF0000", clr);
XWPFBorderType bt = table.getInsideHBorderType();
assertEquals(XWPFBorderType.SINGLE, bt);
}
Aggregations