docx_reader/documents/elements/
text_border.rs

1use serde::{Deserialize, Serialize};
2
3use crate::types::*;
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6#[serde(rename_all = "camelCase")]
7pub struct TextBorder {
8	pub border_type: BorderType,
9	pub size: usize,
10	pub color: String,
11	pub space: usize,
12}
13
14impl TextBorder {
15	pub fn new() -> Self {
16		TextBorder::default()
17	}
18
19	pub fn color(mut self, color: impl Into<String>) -> Self {
20		self.color = color.into();
21		self
22	}
23
24	pub fn size(mut self, size: usize) -> Self {
25		self.size = size;
26		self
27	}
28
29	pub fn space(mut self, space: usize) -> Self {
30		self.space = space;
31		self
32	}
33
34	pub fn border_type(mut self, border_type: BorderType) -> Self {
35		self.border_type = border_type;
36		self
37	}
38}
39
40impl Default for TextBorder {
41	fn default() -> Self {
42		TextBorder {
43			border_type: BorderType::Single,
44			size: 4,
45			space: 0,
46			color: "auto".to_owned(),
47		}
48	}
49}