public void TestRemoveFootnote() { // NOTE: XWPFDocument.removeFootnote() delegates directly to // XWPFFootnotes. docOut.CreateFootnote(); Assert.AreEqual(2, docOut.GetFootnotes().Count, "Expected 2 footnotes"); Assert.IsNotNull(docOut.GetFootnotes()[1], "Didn't get second footnote"); bool result = docOut.RemoveFootnote(0); Assert.IsTrue(result, "Remove footnote did not return true"); Assert.AreEqual(1, docOut.GetFootnotes().Count, "Expected 1 footnote after removal"); }
public void SetUp() { docOut = new XWPFDocument(); p1Text = "First paragraph in footnote"; p2Text = "Second paragraph in footnote"; // NOTE: XWPFDocument.CreateFootnote() delegates directly // to XWPFFootnotes.CreateFootnote() so this tests // both creation of new XWPFFootnotes in document // and XWPFFootnotes.CreateFootnote(); // NOTE: Creating the footnote does not automatically // create a first paragraph. footnote = docOut.CreateFootnote(); footnoteId = footnote.Id; }
public void TestAddFootnotesToDocument() { XWPFDocument docOut = new XWPFDocument(); // NOTE: XWPFDocument.createFootnote() delegates directly // to XWPFFootnotes.createFootnote() so this tests // both creation of new XWPFFootnotes in document // and XWPFFootnotes.createFootnote(); XWPFFootnote footnote = docOut.CreateFootnote(); int noteId = footnote.Id; XWPFDocument docIn = XWPFTestDataSamples.WriteOutAndReadBack(docOut); XWPFFootnote note = docIn.GetFootnoteByID(noteId); Assert.IsNotNull(note); Assert.AreEqual(note.GetCTFtnEdn().type, ST_FtnEdn.normal); }