diff --git a/docx-core/examples/reader.rs b/docx-core/examples/reader.rs index 3410672..b2baf30 100644 --- a/docx-core/examples/reader.rs +++ b/docx-core/examples/reader.rs @@ -4,11 +4,11 @@ use std::fs::File; use std::io::{Read, Write}; pub fn main() { - let mut file = File::open("./hello.docx").unwrap(); + let mut file = File::open("./#3276.docx").unwrap(); let mut buf = vec![]; file.read_to_end(&mut buf).unwrap(); - let mut file = File::create("./hello.json").unwrap(); + let mut file = File::create("./#3276.json").unwrap(); let res = read_docx(&buf).unwrap().json(); file.write_all(res.as_bytes()).unwrap(); file.flush().unwrap(); diff --git a/docx-core/src/documents/elements/run.rs b/docx-core/src/documents/elements/run.rs index 8b07795..772ae63 100644 --- a/docx-core/src/documents/elements/run.rs +++ b/docx-core/src/documents/elements/run.rs @@ -107,13 +107,15 @@ impl Run { } pub fn add_text(mut self, text: impl Into) -> Run { - self.children.push(RunChild::Text(Text::new(text))); + self.children + .push(RunChild::Text(Text::new(text.into().replace('\n', "")))); self } pub fn add_delete_text(mut self, text: impl Into) -> Run { - self.children - .push(RunChild::DeleteText(DeleteText::new(text))); + self.children.push(RunChild::DeleteText(DeleteText::new( + text.into().replace('\n', ""), + ))); self }