docx_reader/documents/elements/
line_spacing.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use crate::line_spacing_type::LineSpacingType;
use serde::*;

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
#[serde(rename_all = "camelCase")]
pub struct LineSpacing {
	#[serde(skip_serializing_if = "Option::is_none")]
	line_rule: Option<LineSpacingType>,
	#[serde(skip_serializing_if = "Option::is_none")]
	before: Option<u32>,
	#[serde(skip_serializing_if = "Option::is_none")]
	after: Option<u32>,
	#[serde(skip_serializing_if = "Option::is_none")]
	before_lines: Option<u32>,
	#[serde(skip_serializing_if = "Option::is_none")]
	after_lines: Option<u32>,
	#[serde(skip_serializing_if = "Option::is_none")]
	line: Option<i32>,
}

impl LineSpacing {
	pub fn new() -> Self {
		Self::default()
	}

	pub fn line_rule(mut self, t: LineSpacingType) -> Self {
		self.line_rule = Some(t);
		self
	}

	pub fn before(mut self, before: u32) -> Self {
		self.before = Some(before);
		self
	}

	pub fn after(mut self, after: u32) -> Self {
		self.after = Some(after);
		self
	}

	pub fn before_lines(mut self, before: u32) -> Self {
		self.before_lines = Some(before);
		self
	}

	pub fn after_lines(mut self, after: u32) -> Self {
		self.after_lines = Some(after);
		self
	}

	pub fn line(mut self, line: i32) -> Self {
		self.line = Some(line as i32);
		self
	}
}