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
#![allow(unused_must_use)]
use strong_xml::{XmlRead, XmlWrite};
use crate::{__setter, __xml_test_suites, document::TableCell, formatting::TableRowProperty};
#[derive(Debug, Default, XmlRead, XmlWrite, Clone)]
#[cfg_attr(test, derive(PartialEq))]
#[xml(tag = "w:tr")]
pub struct TableRow<'a> {
#[xml(default, child = "w:trPr")]
pub property: TableRowProperty,
#[xml(child = "w:tc")]
pub cells: Vec<TableCell<'a>>,
}
impl<'a> TableRow<'a> {
__setter!(property: TableRowProperty);
pub fn push_cell<T: Into<TableCell<'a>>>(mut self, cell: T) -> Self {
self.cells.push(cell.into());
self
}
}
#[cfg(test)]
use crate::document::Paragraph;
__xml_test_suites!(
TableRow,
TableRow::default(),
"<w:tr><w:trPr/></w:tr>",
TableRow::default().push_cell(Paragraph::default()),
"<w:tr><w:trPr/><w:tc><w:tcPr/><w:p/></w:tc></w:tr>",
);