Beispiel #1
0
        /// <summary>
        /// Gets the content for headers and footers.
        /// </summary>
        /// <param name="contentNode">The content node.</param>
        /// <param name="textDocument">The text document.</param>
        /// <returns>The contents as IContentCollection.</returns>
        public ContentCollection GetContentHeaderFooter(XmlNode contentNode, TextDocument textDocument)
        {
            ContentCollection contents = new ContentCollection();

            if (contentNode != null && contentNode.HasChildNodes)
            {
                XmlNode node = null;
                if (textDocument.XmlDoc != contentNode.OwnerDocument)
                {
                    node = textDocument.XmlDoc.ImportNode(contentNode, true);
                }
                else
                {
                    node = contentNode;
                }
                MainContentProcessor mcp = new MainContentProcessor(textDocument);
                foreach (XmlNode nodeChild in node.ChildNodes)
                {
                    IContent iContent = mcp.CreateContent(nodeChild);
                    if (iContent != null)
                    {
                        if (iContent is AODL.Document.Content.Tables.Table)
                        {
                            ((AODL.Document.Content.Tables.Table)iContent).BuildNode();
                        }
                        contents.Add(iContent);
                    }
                }
            }
            return(contents);
        }
Beispiel #2
0
        /// <summary>
        /// Gets the content for headers and footers.
        /// </summary>
        /// <param name="contentNode">The content node.</param>
        /// <param name="textDocument">The text document.</param>
        /// <returns>The contents as IContentCollection.</returns>
        public ContentCollection GetContentHeaderFooter(XElement contentNode, TextDocument textDocument)
        {
            ContentCollection contents = new ContentCollection();

            if (contentNode != null && contentNode.HasElements)
            {
                XElement             node = textDocument.XmlDoc != contentNode.Document ? new XElement(contentNode) : contentNode;
                MainContentProcessor mcp  = new MainContentProcessor(textDocument);
                foreach (XElement nodeChild in node.Elements())
                {
                    IContent iContent = mcp.CreateContent(nodeChild);
                    if (iContent != null)
                    {
                        if (iContent is Table)
                        {
                            ((Table)iContent).BuildNode();
                        }
                        contents.Add(iContent);
                    }
                }
            }
            return(contents);
        }