Exemplo n.º 1
0
        /// <summary>
        /// Create a new footnote and add it to the document.
        /// </summary>
        /// <remarks>
        /// The new note will have one paragraph with the style "FootnoteText"
        /// and one run containing the required footnote reference with the
        /// style "FootnoteReference".
        /// </remarks>
        /// <returns>New XWPFFootnote</returns>
        public XWPFFootnote CreateFootnote()
        {
            CT_FtnEdn newNote = new CT_FtnEdn();

            newNote.type = ST_FtnEdn.normal;

            XWPFFootnote footnote = AddFootnote(newNote);
            int          id       = ctFootnotes.SizeOfFootnoteArray;

            footnote.GetCTFtnEdn().id = id;
            return(footnote);
        }
Exemplo n.º 2
0
        public void TestAddFootnotesToDocument()
        {
            XWPFDocument docOut = new XWPFDocument();

            int noteId = 1;

            XWPFFootnotes footnotes = docOut.CreateFootnotes();
            CT_FtnEdn     ctNote    = new CT_FtnEdn();

            ctNote.id   = (noteId.ToString());
            ctNote.type = (ST_FtnEdn.normal);
            footnotes.AddFootnote(ctNote);

            XWPFDocument docIn = XWPFTestDataSamples.WriteOutAndReadBack(docOut);

            XWPFFootnote note = docIn.GetFootnoteByID(noteId);

            Assert.AreEqual(note.GetCTFtnEdn().type, ST_FtnEdn.normal);
        }
Exemplo n.º 3
0
 public void AddFootnote(XWPFFootnote footnote)
 {
     this.listFootnote.Add(footnote);
     this.ctFootnotes.AddNewFootnote().Set(footnote.GetCTFtnEdn());
 }