UPDATE: Dump of initial files
This commit is contained in:
25
xlsx/src/export/workbook_xml_rels.rs
Normal file
25
xlsx/src/export/workbook_xml_rels.rs
Normal file
@@ -0,0 +1,25 @@
|
||||
use ironcalc_base::types::Workbook;
|
||||
|
||||
use super::xml_constants::{XML_DECLARATION, XML_WORKSHEET};
|
||||
|
||||
pub(crate) fn get_workbook_xml_rels(workbook: &Workbook) -> String {
|
||||
let mut relationships_str: Vec<String> = vec![];
|
||||
let worksheet_count = workbook.worksheets.len() + 1;
|
||||
for id in 1..worksheet_count {
|
||||
relationships_str.push(format!(
|
||||
"<Relationship Id=\"rId{id}\" Type=\"{XML_WORKSHEET}\" Target=\"worksheets/sheet{id}.xml\"/>"
|
||||
));
|
||||
}
|
||||
let mut id = worksheet_count;
|
||||
relationships_str.push(
|
||||
format!("<Relationship Id=\"rId{id}\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles\" Target=\"styles.xml\"/>")
|
||||
);
|
||||
id += 1;
|
||||
relationships_str.push(
|
||||
format!("<Relationship Id=\"rId{id}\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings\" Target=\"sharedStrings.xml\"/>")
|
||||
);
|
||||
format!(
|
||||
"{XML_DECLARATION}\n<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">{}</Relationships>",
|
||||
relationships_str.join("")
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user