Ejemplo n.º 1
0
        public override void Serialize(IntermediateFormatWriter writer)
        {
            base.Serialize(writer);
            writer.RegisterDeclaration(HeaderFooterReferences.GetDeclaration());
            while (writer.NextMember())
            {
                switch (writer.CurrentMember.MemberName)
                {
                case MemberName.Header:
                    writer.Write(this.Header);
                    break;

                case MemberName.Footer:
                    writer.Write(this.Footer);
                    break;

                case MemberName.FirstPageHeader:
                    writer.Write(this.FirstPageHeader);
                    break;

                case MemberName.FirstPageFooter:
                    writer.Write(this.FirstPageFooter);
                    break;

                default:
                    WordOpenXmlUtils.FailSerializable();
                    break;
                }
            }
        }
        public bool TryCreateObject(ObjectType objectType, out IPersistable persistObj)
        {
            switch (objectType)
            {
            case ObjectType.WordOpenXmlTableGrid:
                persistObj = new OpenXmlTableGridModel();
                break;

            case ObjectType.WordOpenXmlTableRowProperties:
                persistObj = new OpenXmlTableRowPropertiesModel();
                break;

            case ObjectType.WordOpenXmlBorderProperties:
                persistObj = new OpenXmlBorderPropertiesModel();
                break;

            case ObjectType.WordOpenXmlHeaderFooterReferences:
                persistObj = new HeaderFooterReferences();
                break;

            default:
                persistObj = null;
                return(false);
            }
            return(true);
        }
Ejemplo n.º 3
0
        private void WriteInterleaverToDocument(IInterleave interleaver, TextWriter output)
        {
            HeaderFooterReferences headerFooterReferences = interleaver as HeaderFooterReferences;

            if (headerFooterReferences != null)
            {
                this._sectionProperties.SetHeaderFooterReferences(headerFooterReferences);
                CT_P cT_P = new CT_P();
                cT_P.PPr = new CT_PPr
                {
                    SectPr = this._sectionProperties.CtSectPr
                };
                CT_P cT_P2 = cT_P;
                cT_P2.Write(output, CT_Body.PElementName);
                this._sectionProperties.ResetHeadersAndFooters();
                if (this._firstSection)
                {
                    this._sectionProperties.Continuous = true;
                    this._firstSection = false;
                }
            }
            else
            {
                interleaver.Write(output);
            }
        }
        private static List <Declaration> BuildDeclarations()
        {
            List <Declaration> list = new List <Declaration>(6);

            list.Add(BaseInterleaver.GetDeclaration());
            list.Add(OpenXmlTableGridModel.GetDeclaration());
            list.Add(OpenXmlTableRowPropertiesModel.GetDeclaration());
            list.Add(OpenXmlBorderPropertiesModel.GetDeclaration());
            list.Add(HeaderFooterReferences.GetDeclaration());
            return(list);
        }