Exemplo n.º 1
0
        void AddNewRelationship(int res_number, string res_id, string res_type)
        {
            Dictionary <string, string> attrs = new Dictionary <string, string>();

            attrs["Id"]     = res_id;
            attrs["Type"]   = res_type;
            attrs["Target"] = "worksheets/sheet" + res_number.ToString() + ".xml";
            XmlElement relships = xml_wb_rels.FindFirstNode("Relationships", new Dictionary <string, string>());

            xml_wb_rels.CreateElement("Relationship", attrs, String.Empty, relships);
            xml_wb_rels.Document.InnerXml = xml_wb_rels.Document.InnerXml.Replace("xmlns=\"\"", String.Empty);
            xml_wb_rels.SaveDocument(temp_path + "\\xl\\_rels\\workbook.xml.rels");
        }
Exemplo n.º 2
0
        void AddSheetInWorkbook(string res_id, string ws_name, short sheet_number)
        {
            Dictionary <string, string> attrs = new Dictionary <string, string>();

            attrs["name"]    = ws_name;
            attrs["r:id"]    = res_id;
            attrs["sheetId"] = sheet_number.ToString();
            xml_workbook.FillXmlElements(xml_workbook.Document);
            XmlElement sheets = xml_workbook.FindFirstNode("sheets", new Dictionary <string, string>());

            var new_el = xml_workbook.CreateNode("sheet", attrs, String.Empty, sheets);


            xml_workbook.Document.InnerXml = xml_workbook.Document.InnerXml.Replace("xmlns=\"\"", String.Empty).Replace("xmlns:r=\"special_ns\"", String.Empty);
            xml_workbook.SaveDocument(temp_path + "\\xl\\workbook.xml");
        }