コード例 #1
0
        public override XmlNode AppendXmlNode(XmlNode parent)
        {
            XmlDocument xmlDoc = (XmlDocument)parent;

            XmlProcessingInstruction instruction = xmlDoc.CreateProcessingInstruction("xml", "version=\"1.0\"");

            xmlDoc.AppendChild(instruction);

            instruction = xmlDoc.CreateProcessingInstruction("mso-application", "progid=\"Excel.Sheet\"");

            xmlDoc.AppendChild(instruction);

            XmlElement node = (XmlElement)xmlDoc.CreateElement("Workbook", Namespaces.spreadsheet);

            node.SetAttribute("xmlns:o", Namespaces.o);
            node.SetAttribute("xmlns:x", Namespaces.x);
            node.SetAttribute("xmlns:ss", Namespaces.ss);
            node.SetAttribute("xmlns:html", Namespaces.html);

            parent.AppendChild(node);

            DocumentProperties.AppendXmlNode(node);

            if (_ExcelWorkbook != null)
            {
                _ExcelWorkbook.AppendXmlNode(node);
            }

            Styles.AppendXmlNode(node);
            Names.AppendXmlNode(node);
            Worksheets.AppendXmlNode(node);

            return(node);
        }