docx_rust/formatting/
page_grid.rs

1use hard_xml::{XmlRead, XmlWrite};
2
3use crate::__string_enum;
4
5/// Numbering Id
6///
7/// ```rust
8/// use docx_rust::formatting::*;
9///
10/// let id = NumberingId::from(42isize);
11/// ```
12#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
13#[cfg_attr(test, derive(PartialEq))]
14#[xml(tag = "w:docGrid")]
15pub struct PageGrid {
16    #[xml(attr = "w:type")]
17    pub ty: Option<GridType>,
18    #[xml(attr = "w:linePitch")]
19    pub line_pitch: Option<isize>,
20    #[xml(attr = "w:charSpace")]
21    pub char_space: Option<isize>,
22}
23
24#[derive(Debug, Clone)]
25#[cfg_attr(test, derive(PartialEq))]
26pub enum GridType {
27    Default,       //	No Document Grid
28    Lines,         //	Line Grid Only
29    LinesAndChars, //	Line and Character Grid
30    SnapToChars,   //	Character Grid Only
31}
32
33__string_enum! {
34    GridType {
35        Default = "default",
36        Lines = "lines",
37        LinesAndChars = "linesAndChars",
38        SnapToChars = "snapToChars",
39    }
40}
41
42// impl<T: Into<isize>> From<T> for NumberingId {
43//     fn from(val: T) -> Self {
44//         NumberingId { value: val.into() }
45//     }
46// }
47
48// __xml_test_suites!(
49//     NumberingId,
50//     NumberingId::from(40isize),
51//     r#"<w:numId w:val="40"/>"#,
52// );