Beispiel #1
0
 public XWPFFootnote(CT_FtnEdn note, XWPFFootnotes xFootnotes)
 {
     footnotes = xFootnotes;
     ctFtnEdn  = note;
     document  = xFootnotes.GetXWPFDocument();
     Init();
 }
Beispiel #2
0
 public XWPFFootnote(CT_FtnEdn note, XWPFFootnotes xFootnotes)
 {
     footnotes = xFootnotes;
     ctFtnEdn  = note;
     foreach (CT_P p in ctFtnEdn.GetPList())
     {
         paragraphs.Add(new XWPFParagraph(p, this));
     }
 }
Beispiel #3
0
 public XWPFFootnote(CT_FtnEdn note, XWPFFootnotes xFootnotes)
 {
     this.footnotes = xFootnotes;
     this.ctFtnEdn  = note;
     foreach (CT_P prgrph in (IEnumerable <CT_P>) this.ctFtnEdn.GetPList())
     {
         this.paragraphs.Add(new XWPFParagraph(prgrph, (IBody)this));
     }
 }
Beispiel #4
0
 public XWPFFootnotes CreateFootnotes()
 {
     if (this.footnotes == null)
     {
         FootnotesDocument footnotesDocument = new FootnotesDocument();
         XWPFRelation      footnote          = XWPFRelation.FOOTNOTE;
         int           relationIndex         = this.GetRelationIndex(footnote);
         XWPFFootnotes relationship          = (XWPFFootnotes)this.CreateRelationship((POIXMLRelation)footnote, (POIXMLFactory)XWPFFactory.GetInstance(), relationIndex);
         relationship.SetFootnotes(footnotesDocument.Footnotes);
         this.footnotes = relationship;
     }
     return(this.footnotes);
 }
Beispiel #5
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 #6
0
 private void InitFootnotes()
 {
     foreach (POIXMLDocumentPart relation in this.GetRelations())
     {
         string relationshipType = relation.GetPackageRelationship().RelationshipType;
         if (relationshipType.Equals(XWPFRelation.FOOTNOTE.Relation))
         {
             FootnotesDocument footnotesDocument = FootnotesDocument.Parse(relation.GetPackagePart().GetInputStream());
             this.footnotes = (XWPFFootnotes)relation;
             this.footnotes.OnDocumentRead();
             foreach (CT_FtnEdn note in footnotesDocument.Footnotes.footnote)
             {
                 this.footnotes.AddFootnote(note);
             }
         }
         else if (relationshipType.Equals(XWPFRelation.ENDNOTE.Relation))
         {
             foreach (CT_FtnEdn body in EndnotesDocument.Parse(relation.GetPackagePart().GetInputStream()).Endnotes.endnote)
             {
                 this.endnotes.Add(int.Parse(body.id), new XWPFFootnote(this, body));
             }
         }
     }
 }
Beispiel #7
0
        /**
         * Creates an empty footnotes element for the document if one does not already exist
         * @return footnotes
         */
        public XWPFFootnotes CreateFootnotes()
        {
            if (footnotes == null)
            {
                FootnotesDocument footnotesDoc = new FootnotesDocument();

                XWPFRelation relation = XWPFRelation.FOOTNOTE;
                int i = GetRelationIndex(relation);

                XWPFFootnotes wrapper = (XWPFFootnotes)CreateRelationship(relation, XWPFFactory.GetInstance(), i);
                wrapper.SetFootnotes(footnotesDoc.Footnotes);
                footnotes = wrapper;
            }

            return footnotes;
        }
Beispiel #8
0
 private void InitFootnotes()
 {
     foreach(POIXMLDocumentPart p in GetRelations()){
        String relation = p.GetPackageRelationship().RelationshipType;
        if (relation.Equals(XWPFRelation.FOOTNOTE.Relation)) {
           this.footnotes = (XWPFFootnotes)p;
           this.footnotes.OnDocumentRead();
        }
        else if (relation.Equals(XWPFRelation.ENDNOTE.Relation))
        {
            XmlDocument xmldoc = ConvertStreamToXml(p.GetPackagePart().GetInputStream());
            EndnotesDocument endnotesDocument = EndnotesDocument.Parse(xmldoc, NamespaceManager);
            foreach (CT_FtnEdn ctFtnEdn in endnotesDocument.Endnotes.endnote)
            {
                endnotes.Add(Int32.Parse(ctFtnEdn.id), new XWPFFootnote(this, ctFtnEdn));
            }
        }
     }
 }
Beispiel #9
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));
                  }
               }
            }
        }
Beispiel #10
0
 private void InitFootnotes()
 {
     foreach(POIXMLDocumentPart p in GetRelations()){
        String relation = p.GetPackageRelationship().RelationshipType;
        if (relation.Equals(XWPFRelation.FOOTNOTE.Relation)) {
            XmlDocument xmldoc = ConvertStreamToXml(p.GetPackagePart().GetInputStream());
           FootnotesDocument footnotesDocument = FootnotesDocument.Parse(xmldoc, NamespaceManager);
           this.footnotes = (XWPFFootnotes)p;
           this.footnotes.OnDocumentRead();
           
        } else if (relation.Equals(XWPFRelation.ENDNOTE.Relation)){
            XmlDocument xmldoc = ConvertStreamToXml(p.GetPackagePart().GetInputStream());
            EndnotesDocument endnotesDocument = EndnotesDocument.Parse(xmldoc, NamespaceManager);
        }
     }
 }