Beispiel #1
0
        /**
         * save and Commit footer
         */

        protected override void Commit()
        {
            /*XmlOptions xmlOptions = new XmlOptions(DEFAULT_XML_OPTIONS);
            xmlOptions.SaveSyntheticDocumentElement=(new QName(CTNumbering.type.Name.NamespaceURI, "ftr"));
            Dictionary<String,String> map = new Dictionary<String, String>();
            map.Put("http://schemas.Openxmlformats.org/markup-compatibility/2006", "ve");
            map.Put("urn:schemas-microsoft-com:office:office", "o");
            map.Put("http://schemas.Openxmlformats.org/officeDocument/2006/relationships", "r");
            map.Put("http://schemas.Openxmlformats.org/officeDocument/2006/math", "m");
            map.Put("urn:schemas-microsoft-com:vml", "v");
            map.Put("http://schemas.Openxmlformats.org/drawingml/2006/wordProcessingDrawing", "wp");
            map.Put("urn:schemas-microsoft-com:office:word", "w10");
            map.Put("http://schemas.Openxmlformats.org/wordProcessingml/2006/main", "w");
            map.Put("http://schemas.microsoft.com/office/word/2006/wordml", "wne");
            xmlOptions.SaveSuggestedPrefixes=(map);*/
            PackagePart part = GetPackagePart();
            using (Stream out1 = part.GetOutputStream())
            {
                FtrDocument doc = new FtrDocument((CT_Ftr)headerFooter);
                doc.Save(out1);
            }
        }
        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);

            Stream outputStream = wrapper.GetPackagePart().GetOutputStream();
            ftrDoc.SetFtr((CT_Ftr)ftr);

            //XmlOptions xmlOptions = Commit(wrapper);

            assignFooter(wrapper, type);
            ftrDoc.Save(outputStream, Commit(wrapper));
            outputStream.Close();
            return wrapper;
        }