예제 #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);
        }
예제 #2
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.InsideHBorderSize;
     Assert.AreEqual(4, s);
     int sp = table.InsideHBorderSpace;
     Assert.AreEqual(0, sp);
     String clr = table.InsideHBorderColor;
     Assert.AreEqual("FF0000", clr);
     NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType bt = table.InsideHBorderType;
     Assert.AreEqual(NPOI.XWPF.UserModel.XWPFTable.XWPFBorderType.SINGLE, bt);
 }