Given an xlsx file,
- construct an XlsxPath with XlsxPath::from_str,
- then use ImgLoader::new(XlsxPath) to copy this xlsx file and unzip it, then parse the xml files to get a map of SheetName -> {(col, row) : imagePath}
use lib_xlsx_img_loader::{ImgLoader, XlsxPath};
use read_input::prelude::*;
use std::str::FromStr;
fn main() {
println!("input xlsx to unzip: ");
let unzip_dir = "./unzip";
let input_xlsx = input::<String>().get();
match XlsxPath::from_str(&input_xlsx) {
Ok(xlsx_path) => {
if let Ok(ImgLoader {
ref xlsx_path,
ref unzip_dir,
ref worksheet_name_id_map,
ref worksheet_name_img_map,
ref worksheet_id_img_map
}) = ImgLoader::new(&xlsx_path, unzip_dir) {
dbg!(&worksheet_name_id_map);
dbg!(worksheet_name_img_map);
println!("Hey, it works!");
}
}
Err(e) => println!("{e}"),
}
}