Esempio 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");
        }
Esempio 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");
        }
Esempio n. 3
0
        private void SaveSharedStrings()
        {
            string inner_xml_header = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
                                      "<sst xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\" count=\"100000\" uniqueCount=\"99000\">";
            string inner_xml_footer = "</sst>";
            string strgs            = String.Empty;

            foreach (KeyValuePair <int, string> sh_str in shared_strings)
            {
                strgs += "<si><t>" + sh_str.Value + "</t></si>";
            }
            if (xml_shared_strings == null)
            {
                xml_shared_strings = new AmusingXml.XmlFun();
            }
            xml_shared_strings.Document.InnerXml = inner_xml_header + strgs + inner_xml_footer;
            xml_shared_strings.SaveDocument(temp_path + "\\xl\\sharedStrings.xml");
        }