docx_reader/documents/elements/
page_margin.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
use crate::types::PageMargin;

// These values were based on microsoft office word2019 windows edition.
// <w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0"/>
impl Default for PageMargin {
	fn default() -> PageMargin {
		PageMargin {
			top: 1985,
			left: 1701,
			bottom: 1701,
			right: 1701,
			header: 851,
			footer: 992,
			gutter: 0,
		}
	}
}

impl PageMargin {
	pub fn new() -> PageMargin {
		Default::default()
	}

	pub fn top(self, v: i32) -> PageMargin {
		PageMargin { top: v, ..self }
	}

	pub fn left(self, v: i32) -> PageMargin {
		PageMargin { left: v, ..self }
	}

	pub fn bottom(self, v: i32) -> PageMargin {
		PageMargin { bottom: v, ..self }
	}

	pub fn right(self, v: i32) -> PageMargin {
		PageMargin { right: v, ..self }
	}

	pub fn header(self, v: i32) -> PageMargin {
		PageMargin { header: v, ..self }
	}

	pub fn footer(self, v: i32) -> PageMargin {
		PageMargin { footer: v, ..self }
	}

	pub fn gutter(self, v: i32) -> PageMargin {
		PageMargin { gutter: v, ..self }
	}
}