BuildNode() public méthode

Builds the node.
public BuildNode ( ) : XmlNode
Résultat System.Xml.XmlNode
Exemple #1
0
        /// <summary>
        /// Builds the node.
        /// </summary>
        /// <returns></returns>
        public XmlNode BuildNode()
        {
            if (Forms.Count != 0)
            {
                XmlNode nodeForms = Node.SelectSingleNode("office:forms", this.Document.NamespaceManager);
                if (nodeForms == null)
                {
                    nodeForms = this.Document.CreateNode("forms", "office");
                }

                foreach (ODFForm f in Forms)
                {
                    nodeForms.AppendChild(f.Node);
                }
                Node.AppendChild(nodeForms);
            }


            foreach (Column column in this.ColumnCollection)
            {
                this.Node.AppendChild(column.Node);
            }

            if (this.RowHeader != null)
            {
                this.Node.AppendChild(this.RowHeader.Node);
            }

            foreach (Row row in this.Rows)
            {
                //check for nested tables
                foreach (Cell cell in row.Cells)
                {
                    foreach (IContent iContent in cell.Content)
                    {
                        if (iContent is Table)
                        {
                            Table table = iContent as Table;
                            table.BuildNode();
                        }
                    }
                }
                //now, append the row node
                this.Node.AppendChild(row.Node);
            }

            return(this.Node);
        }
Exemple #2
0
        /// <summary>
        /// Builds the node.
        /// </summary>
        /// <returns></returns>
        public XElement BuildNode()
        {
            if (Forms.Count != 0)
            {
                XElement nodeForms = Node.Element(Ns.Office + "forms");
                if (nodeForms == null)
                {
                    nodeForms = new XElement(Ns.Office + "forms");
                }

                foreach (ODFForm f in Forms)
                {
                    nodeForms.Add(f.Node);
                }
                Node.Add(nodeForms);
            }


            foreach (Column column in ColumnCollection)
            {
                Node.Add(column.Node);
            }

            if (RowHeader != null)
            {
                Node.Add(RowHeader.Node);
            }

            foreach (Row row in Rows)
            {
                //check for nested tables
                foreach (Cell cell in row.Cells)
                {
                    foreach (IContent iContent in cell.Content)
                    {
                        if (iContent is Table)
                        {
                            Table table = iContent as Table;
                            table.BuildNode();
                        }
                    }
                }
                //now, append the row node
                Node.Add(row.Node);
            }

            return(Node);
        }