Beispiel #1
0
        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.
            CT_TblBorders cttb = new CT_TblBorders();

            Assert.IsNotNull(cttb);
            ST_Border stb = new ST_Border();

            Assert.IsNotNull(stb);
            // create a table
            XWPFDocument doc     = new XWPFDocument();
            CT_Tbl       ctTable = new CT_Tbl();
            XWPFTable    table   = new XWPFTable(ctTable, doc);

            // Set inside horizontal border
            table.SetInsideHBorder(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.SINGLE, 4, 0, "FF0000");
            // Get inside horizontal border components
            int s = table.GetInsideHBorderSize();

            Assert.AreEqual(4, s);
            int sp = table.GetInsideHBorderSpace();

            Assert.AreEqual(0, sp);
            String clr = table.GetInsideHBorderColor();

            Assert.AreEqual("FF0000", clr);
            NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType bt = table.GetInsideHBorderType();
            Assert.AreEqual(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.SINGLE, bt);
        }
Beispiel #2
0
        public void TestSetGetVBorders()
        {
            // create a table
            XWPFDocument doc     = new XWPFDocument();
            CT_Tbl       ctTable = new CT_Tbl();
            XWPFTable    table   = new XWPFTable(ctTable, doc);

            // Set inside vertical border
            table.SetInsideVBorder(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.DOUBLE, 4, 0, "00FF00");
            // Get inside vertical border components
            NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType bt = table.GetInsideVBorderType();
            Assert.AreEqual(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.DOUBLE, bt);
            int sz = table.GetInsideVBorderSize();

            Assert.AreEqual(4, sz);
            int sp = table.GetInsideVBorderSpace();

            Assert.AreEqual(0, sp);
            String clr = table.GetInsideVBorderColor();

            Assert.AreEqual("00FF00", clr);
        }