docx_reader/documents/
document_rels.rs

1use serde::Serialize;
2
3#[derive(Debug, Clone, PartialEq, Serialize, Default)]
4#[serde(rename_all = "camelCase")]
5pub struct DocumentRels {
6	pub has_comments: bool,
7	pub has_numberings: bool,
8	pub images: Vec<(String, String)>,
9	pub hyperlinks: Vec<(String, String, String)>,
10	pub custom_xml_count: usize,
11	pub header_count: usize,
12	pub footer_count: usize,
13}
14
15impl DocumentRels {
16	pub fn new() -> DocumentRels {
17		Default::default()
18	}
19
20	pub fn add_custom_item(mut self) -> Self {
21		self.custom_xml_count += 1;
22		self
23	}
24
25	pub fn add_image(mut self, id: impl Into<String>, path: impl Into<String>) -> Self {
26		self.images.push((id.into(), path.into()));
27		self
28	}
29
30	pub fn add_hyperlinks(
31		mut self,
32		id: impl Into<String>,
33		path: impl Into<String>,
34		r#type: impl Into<String>,
35	) -> Self {
36		self.hyperlinks
37			.push((id.into(), path.into(), r#type.into()));
38		self
39	}
40}