public XWPFFooter CreateFooter(ST_HdrFtr type, XWPFParagraph[] pars)
        {
            XWPFRelation footer        = XWPFRelation.FOOTER;
            string       pStyle        = "Footer";
            int          relationIndex = this.GetRelationIndex(footer);
            FtrDocument  ftrDocument   = new FtrDocument();
            XWPFFooter   relationship  = (XWPFFooter)this.doc.CreateRelationship((POIXMLRelation)footer, (POIXMLFactory)XWPFFactory.GetInstance(), relationIndex);
            CT_HdrFtr    headerFooter  = this.buildFtr(type, pStyle, (XWPFHeaderFooter)relationship, pars);

            relationship.SetHeaderFooter(headerFooter);
            Stream outputStream = relationship.GetPackagePart().GetOutputStream();

            ftrDocument.SetFtr((CT_Ftr)headerFooter);
            this.assignFooter(relationship, type);
            ftrDocument.Save(outputStream, this.Commit((XWPFHeaderFooter)relationship));
            outputStream.Close();
            return(relationship);
        }
Пример #2
0
        public XWPFFooter CreateFooter(ST_HdrFtr type, XWPFParagraph[] pars)
        {
            XWPFRelation relation = XWPFRelation.FOOTER;
            String       pStyle   = "Footer";
            int          i        = GetRelationIndex(relation);
            FtrDocument  ftrDoc   = new FtrDocument();
            XWPFFooter   wrapper  = (XWPFFooter)doc.CreateRelationship(relation, XWPFFactory.GetInstance(), i);

            CT_HdrFtr ftr = buildFtr(type, pStyle, wrapper, pars);

            wrapper.SetHeaderFooter(ftr);

            ftrDoc.SetFtr((CT_Ftr)ftr);

            assignFooter(wrapper, type);
            using (Stream outputStream = wrapper.GetPackagePart().GetOutputStream())
            {
                ftrDoc.Save(outputStream);
            }
            return(wrapper);
        }