]> source.dussan.org Git - poi.git/commitdiff
Patch from tntim96 from bug #56799 - Include CTTblGrid in the smaller poi-ooxml-schem...
authorNick Burch <nick@apache.org>
Thu, 5 Mar 2015 06:31:18 +0000 (06:31 +0000)
committerNick Burch <nick@apache.org>
Thu, 5 Mar 2015 06:31:18 +0000 (06:31 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1664236 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xwpf/usermodel/TestXWPFTable.java

index 00496b299fd01109334504c50f4c8777e571ade9..7d185637f1461aac454d4fea18a8d5b24f7b4928 100644 (file)
@@ -29,6 +29,7 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTRow;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblBorders;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblCellMar;
+import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblGrid;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText;
 import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder;
@@ -64,6 +65,17 @@ public class TestXWPFTable extends TestCase {
         assertNotNull(ctTable.getTrArray(0).getTcArray(0).getPArray(0));
     }
 
+    public void testTblGrid() {
+        XWPFDocument doc = new XWPFDocument();
+        CTTbl ctTable = CTTbl.Factory.newInstance();
+        CTTblGrid cttblgrid = ctTable.addNewTblGrid();
+        cttblgrid.addNewGridCol().setW(new BigInteger("123"));
+        cttblgrid.addNewGridCol().setW(new BigInteger("321"));
+
+        XWPFTable xtab = new XWPFTable(ctTable, doc);
+        assertEquals(123, xtab.getCTTbl().getTblGrid().getGridColArray(0).getW().intValue());
+        assertEquals(321, xtab.getCTTbl().getTblGrid().getGridColArray(1).getW().intValue());
+    }
 
     public void testGetText() {
         XWPFDocument doc = new XWPFDocument();