Beispiel #1
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);
        }
Beispiel #2
0
        private void InitFootnotes()
        {
            foreach(POIXMLDocumentPart p in GetRelations()){
               String relation = p.GetPackageRelationship().RelationshipType;
               if (relation.Equals(XWPFRelation.FOOTNOTE.Relation)) {
                  FootnotesDocument footnotesDocument = FootnotesDocument.Parse(p.GetPackagePart().GetInputStream());
                  this.footnotes = (XWPFFootnotes)p;
                  this.footnotes.OnDocumentRead();

                  foreach (CT_FtnEdn ctFtnEdn in footnotesDocument.Footnotes.footnote)
                  {
                     footnotes.AddFootnote(ctFtnEdn);
                  }
               } else if (relation.Equals(XWPFRelation.ENDNOTE.Relation)){
                   EndnotesDocument endnotesDocument = EndnotesDocument.Parse(p.GetPackagePart().GetInputStream());

                  foreach(CT_FtnEdn ctFtnEdn in endnotesDocument.Endnotes.endnote) {
                     endnotes.Add(int.Parse(ctFtnEdn.id), new XWPFFootnote(this, ctFtnEdn));
                  }
               }
            }
        }