docx-rs/docx-core/examples/reader.rs

16 lines
384 B
Rust
Raw Normal View History

use docx_rs::*;
2020-10-05 10:19:05 +03:00
use std::fs::File;
use std::io::{Read, Write};
pub fn main() {
let mut file = File::open("./center.docx").unwrap();
let mut buf = vec![];
file.read_to_end(&mut buf).unwrap();
2020-10-05 10:19:05 +03:00
let mut file = File::create("./test.json").unwrap();
let res = read_docx(&buf).unwrap().json();
file.write_all(res.as_bytes()).unwrap();
file.flush().unwrap();
}