docx_rust/formatting/
table_row_property.rs

1use hard_xml::{XmlRead, XmlWrite};
2
3use crate::{__setter, __xml_test_suites, formatting::TableHeader, formatting::TableJustification};
4
5/// Table Row Property
6///
7/// ```rust
8/// use docx_rust::formatting::{TableRowProperty, TableJustificationVal};
9///
10/// let prop = TableRowProperty::default()
11///     .justification(TableJustificationVal::Start);
12/// ```
13#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
14#[cfg_attr(test, derive(PartialEq))]
15#[xml(tag = "w:trPr")]
16pub struct TableRowProperty {
17    /// Specifies the alignment of the row with respect to the text margins in the section.
18    #[xml(child = "w:jc")]
19    pub justification: Option<TableJustification>,
20    /// Repeat Table Row on Every New Page
21    #[xml(child = "w:tblHeader")]
22    pub table_header: Option<TableHeader>,
23}
24
25impl TableRowProperty {
26    __setter!(justification: Option<TableJustification>);
27    __setter!(table_header: Option<TableHeader>);
28}
29
30__xml_test_suites!(
31    TableRowProperty,
32    TableRowProperty::default(),
33    r#"<w:trPr/>"#,
34    TableRowProperty::default()
35        .justification(crate::formatting::TableJustificationVal::Start)
36        .table_header(crate::formatting::OnOffOnlyType::On),
37    r#"<w:trPr><w:jc w:val="start"/><w:tblHeader w:val="on"/></w:trPr>"#,
38);