diff --git a/docx-core/src/reader/run.rs b/docx-core/src/reader/run.rs index b80edc2f8..5bb65cdae 100644 --- a/docx-core/src/reader/run.rs +++ b/docx-core/src/reader/run.rs @@ -253,8 +253,8 @@ mod tests { run_property: RunProperty { bold: Some(Bold::new()), bold_cs: Some(BoldCs::new()), - italic: Some(Italic::new().disable()), - italic_cs: Some(ItalicCs::new().disable()), + italic: None, + italic_cs: None, ..RunProperty::default() }, } @@ -278,8 +278,8 @@ mod tests { run_property: RunProperty { bold: Some(Bold::new()), bold_cs: Some(BoldCs::new()), - italic: Some(Italic::new().disable()), - italic_cs: Some(ItalicCs::new().disable()), + italic: None, + italic_cs: None, ..RunProperty::default() }, } diff --git a/docx-core/src/reader/run_property.rs b/docx-core/src/reader/run_property.rs index df8af7b72..473e2e380 100644 --- a/docx-core/src/reader/run_property.rs +++ b/docx-core/src/reader/run_property.rs @@ -66,19 +66,15 @@ impl ElementReader for RunProperty { } } XMLElement::Bold => { - if !read_bool(&attributes) { - rp = rp.disable_bold(); - continue; + if read_bool(&attributes) { + rp = rp.bold(); } - rp = rp.bold(); } XMLElement::Highlight => rp = rp.highlight(attributes[0].value.clone()), XMLElement::Strike => { - if !read_bool(&attributes) { - rp.strike = Some(Strike::new().disable()); - continue; + if read_bool(&attributes) { + rp = rp.strike(); } - rp = rp.strike(); } XMLElement::VertAlign => { if let Ok(v) = VertAlignType::from_str(&attributes[0].value) { @@ -100,11 +96,10 @@ impl ElementReader for RunProperty { } XMLElement::Underline => rp = rp.underline(&attributes[0].value.clone()), XMLElement::Italic => { - if !read_bool(&attributes) { - rp = rp.disable_italic(); - continue; + if read_bool(&attributes) { + rp = rp.italic(); } - rp = rp.italic(); + } XMLElement::Vanish => rp = rp.vanish(), XMLElement::TextBorder => {