public void TestAddTableToFootnote() { XWPFTable table = footnote.CreateTable(); Assert.IsNotNull(table); XWPFDocument docIn = XWPFTestDataSamples.WriteOutAndReadBack(docOut); XWPFFootnote testFootnote = docIn.GetFootnoteByID(footnoteId); XWPFTable testTable = testFootnote.GetTableArray(0); Assert.IsNotNull(testTable); table = footnote.CreateTable(2, 3); Assert.AreEqual(2, table.NumberOfRows); Assert.AreEqual(3, table.GetRow(0).GetTableCells().Count); // If the table is the first body element of the footnote then // a paragraph with the footnote reference should have been // added automatically. Assert.AreEqual(3, footnote.BodyElements.Count, "Expected 3 body elements"); IBodyElement testP1 = footnote.BodyElements[0]; Assert.IsTrue(testP1 is XWPFParagraph, "Expected a paragraph, got " + testP1.GetType().Name); XWPFRun r1 = ((XWPFParagraph)testP1).Runs[0]; Assert.IsNotNull(r1); Assert.IsTrue(r1.GetCTR().GetFootnoteRefList().Count > 0, "No footnote reference in testP1"); Assert.IsNotNull(r1.GetCTR().GetFootnoteRefArray(0), "No footnote reference in testP1"); }