Search in sources :

Example 1 with XWPFBorderType

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

Example 2 with XWPFBorderType

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);
}
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)2 CTTbl (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl)2 CTTblBorders (org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblBorders)1 STBorder (org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder)1