docx_rs/documents/elements/
q_format.rs

1use crate::documents::BuildXML;
2use crate::xml_builder::*;
3
4//17.7.4.14
5// qFormat (Primary Style)
6// This element specifies whether this style shall be treated as a primary style when this document is loaded by an
7// application. If this element is set, then this style has been designated as being particularly important for the
8// current document, and this information can be used by an application in any means desired. [Note: This setting
9// 637ECMA-376 Part 1 does not imply any behavior for the style, only that the style is of particular significance for this document. end note]
10pub struct QFormat {}
11
12impl QFormat {
13    pub fn new() -> QFormat {
14        Default::default()
15    }
16}
17
18impl Default for QFormat {
19    fn default() -> Self {
20        Self {}
21    }
22}
23
24impl BuildXML for QFormat {
25    fn build(&self) -> Vec<u8> {
26        let b = XMLBuilder::new();
27        b.q_format().build()
28    }
29}
30
31#[cfg(test)]
32mod tests {
33
34    use super::*;
35    #[cfg(test)]
36    use pretty_assertions::assert_eq;
37    use std::str;
38
39    #[test]
40    fn test_q_format() {
41        let c = QFormat::new();
42        let b = c.build();
43        assert_eq!(str::from_utf8(&b).unwrap(), r#"<w:qFormat />"#);
44    }
45}