From 0284e7aa4c51b612589266bc575798b65884cb71 Mon Sep 17 00:00:00 2001 From: git-noise <63017366+git-noise@users.noreply.github.com> Date: Sat, 29 Jun 2024 06:24:01 -0400 Subject: [PATCH] Support strike at Run level: add strike() to Run (#732) --- docx-core/src/documents/elements/run.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docx-core/src/documents/elements/run.rs b/docx-core/src/documents/elements/run.rs index c800f7c..786ceea 100644 --- a/docx-core/src/documents/elements/run.rs +++ b/docx-core/src/documents/elements/run.rs @@ -268,6 +268,11 @@ impl Run { self } + pub fn strike(mut self) -> Run { + self.run_property = self.run_property.strike(); + self + } + pub fn text_border(mut self, b: TextBorder) -> Run { self.run_property = self.run_property.text_border(b); self @@ -366,6 +371,15 @@ mod tests { ); } + #[test] + fn test_strike() { + let b = Run::new().add_text("Hello").strike().build(); + assert_eq!( + str::from_utf8(&b).unwrap(), + r#"Hello"# + ); + } + #[test] fn test_child_json() { let c = RunChild::Text(Text::new("Hello"));