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

16 lines
400 B
Rust

use docx_rs::*;
use std::fs::File;
use std::io::{Read, Write};
pub fn main() {
let mut file = File::open("./fixtures/custom/custom.docx").unwrap();
let mut buf = vec![];
file.read_to_end(&mut buf).unwrap();
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();
}