Skip to content

Given an xlsx file, decompress it, and retrieve a map of {sheetname: {(col, row): img_path}

Notifications You must be signed in to change notification settings

wellitecho/lib_xlsx_img_loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Given an xlsx file,

  1. construct an XlsxPath with XlsxPath::from_str,
  2. 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}

Example

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}"),
    }
    
}

About

Given an xlsx file, decompress it, and retrieve a map of {sheetname: {(col, row): img_path}

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages