Search in sources :

Example 1 with STBorder

use of org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder 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);
}
Also used : XWPFBorderType(org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType) STBorder(org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder) CTTblBorders(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblBorders) CTTbl(org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl)

Aggregations

XWPFBorderType (org.apache.poi.xwpf.usermodel.XWPFTable.XWPFBorderType)1 CTTbl (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl)1 CTTblBorders (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblBorders)1 STBorder (org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder)1