diff --git a/crates/idml/src/model/mod.rs b/crates/idml/src/model/mod.rs index 7282d4655..bfca5923b 100644 --- a/crates/idml/src/model/mod.rs +++ b/crates/idml/src/model/mod.rs @@ -78,6 +78,19 @@ pub struct AlternatingStrokeValues { pub skip_last: Option, } +#[derive(Clone, Debug, Default, PartialEq)] +pub struct TableOptions { + pub direction: Option, + pub header_rows: Option, + pub footer_rows: Option, + pub applied_style: Option, + pub space_before: Option, + pub space_after: Option, + pub repeat_header: bool, + pub repeat_footer: bool, + pub borders: [StrokeValues; 4], +} + impl Values { /// The attributes and `` of `el`. pub fn of(el: &El) -> Values { @@ -240,6 +253,25 @@ impl Values { skip_last: num(&format!("SkipLastAlternatingStroke{kind}s")), } } + + pub fn table_options(&self) -> TableOptions { + TableOptions { + direction: self.value("TableDirection"), + header_rows: self.num("HeaderRowCount"), + footer_rows: self.num("FooterRowCount"), + applied_style: self.value("AppliedTableStyle"), + space_before: self.num("SpaceBefore"), + space_after: self.num("SpaceAfter"), + repeat_header: self.get("HeaderBehavior") != Some("RepeatOnce"), + repeat_footer: self.get("FooterBehavior") != Some("RepeatOnce"), + borders: [ + self.stroke_values("TopBorder"), + self.stroke_values("LeftBorder"), + self.stroke_values("BottomBorder"), + self.stroke_values("RightBorder"), + ], + } + } } /// `el` without its indentation: the whitespace-only text between the children of an element