2020-02-11 10:01:39 +02:00
|
|
|
use docx_rs::*;
|
2020-10-05 10:19:05 +03:00
|
|
|
|
|
|
|
use std::fs::File;
|
|
|
|
use std::io::{Read, Write};
|
2020-02-11 10:01:39 +02:00
|
|
|
|
|
|
|
pub fn main() {
|
2024-03-18 10:28:52 +02:00
|
|
|
let mut file = File::open("./hello.docx").unwrap();
|
2020-02-11 10:01:39 +02:00
|
|
|
let mut buf = vec![];
|
|
|
|
file.read_to_end(&mut buf).unwrap();
|
2020-10-05 10:19:05 +03:00
|
|
|
|
2022-04-22 09:24:15 +03:00
|
|
|
let mut file = File::create("./hello.json").unwrap();
|
2020-10-05 10:19:05 +03:00
|
|
|
let res = read_docx(&buf).unwrap().json();
|
|
|
|
file.write_all(res.as_bytes()).unwrap();
|
|
|
|
file.flush().unwrap();
|
2020-02-11 10:01:39 +02:00
|
|
|
}
|