Parse IDML table options

This commit is contained in:
Dylan M. Taylor committed 2026-11-13 09:05:19 -05:00
1 parent b9715e592b
commit c59aad77b3
1 file changed
+32
+32
View File
@@ -78,6 +78,19 @@ pub struct AlternatingStrokeValues {
pub skip_last: Option<f64>,
}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct TableOptions {
pub direction: Option<String>,
pub header_rows: Option<f64>,
pub footer_rows: Option<f64>,
pub applied_style: Option<String>,
pub space_before: Option<f64>,
pub space_after: Option<f64>,
pub repeat_header: bool,
pub repeat_footer: bool,
pub borders: [StrokeValues; 4],
}
impl Values {
/// The attributes and `<Properties>` 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