fix: remove \n in text (#461)
parent
0af4da71b8
commit
fbe0d73ecb
|
@ -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();
|
||||
|
|
|
@ -107,13 +107,15 @@ impl Run {
|
|||
}
|
||||
|
||||
pub fn add_text(mut self, text: impl Into<String>) -> 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<String>) -> Run {
|
||||
self.children
|
||||
.push(RunChild::DeleteText(DeleteText::new(text)));
|
||||
self.children.push(RunChild::DeleteText(DeleteText::new(
|
||||
text.into().replace('\n', ""),
|
||||
)));
|
||||
self
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue