Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

doe

Package Overview
Dependencies
Maintainers
1
Versions
254
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

doe - npm Package Compare versions

Comparing version
1.1.75
to
1.1.76
+1
-1
.cargo_vcs_info.json
{
"git": {
"sha1": "c68319c5d3f004380e3ba76b7a256cfe3f93601f"
"sha1": "2e8e8d58814ebd01371138475a9da123ef21fcd7"
},
"path_in_vcs": ""
}

@@ -15,3 +15,3 @@ # THIS FILE IS AUTOMATICALLY GENERATED BY CARGO

name = "doe"
version = "1.1.75"
version = "1.1.76"
authors = ["Andrew <dnrops@outlook.com>"]

@@ -18,0 +18,0 @@ build = false

@@ -37,2 +37,4 @@ /// xlsx model

for (c_index,val) in row.iter().enumerate(){
let (col_name,_) = position_to_coordinate_tuple(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;
sheet.get_column_dimension_mut(&col_name).set_auto_width(true);
let coordinate = position_to_coordinate(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;

@@ -71,2 +73,5 @@ let mut cell = sheet.get_cell_value_mut(coordinate.to_string());

for (c_index,val) in row.iter().enumerate(){
let (col_name,_) = position_to_coordinate_tuple(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;
sheet.get_column_dimension_mut(&col_name).set_auto_width(true);
let coordinate = position_to_coordinate(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;

@@ -86,2 +91,38 @@ let mut cell = sheet.get_cell_value_mut(coordinate.to_string());

// if width == -1.0 => set_auto_width else set with width val
pub fn write_xlsx_with_sheet_data_list_with_width(xlsx_path: impl AsRef<Path>,sheet_data:Vec<SheetData>,width:Option<f64>)->anyhow::Result<()>{
use crate::xlsx;
let mut xlsx_book = xlsx::new_file();
let _ = xlsx_book.remove_sheet_by_name("Sheet1");
for sd in sheet_data{
let sheet_name = sd.sheet_name;
let csv_data = sd.csv_data;
let mut st = Worksheet::default();
st.set_name(sheet_name.to_string());
xlsx_book.add_sheet(st).map_err(|s|anyhow!(s))?;
// xlsx_book.set_sheet_name(0, "Sheet1");
if let Some(mut sheet) = xlsx_book.get_sheet_by_name_mut(&sheet_name.to_string()) {
for (r_index,row) in csv_data.iter().enumerate(){
for (c_index,val) in row.iter().enumerate(){
let (col_name,_) = position_to_coordinate_tuple(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;
if width.is_none(){
sheet.get_column_dimension_mut(&col_name).set_auto_width(true);
}else{
sheet.get_column_dimension_mut(&col_name).set_width(width.unwrap_or_default());
}
let coordinate = position_to_coordinate(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;
let mut cell = sheet.get_cell_value_mut(coordinate.to_string());
cell.set_value_string(val.to_string());
}
}
} else {
anyhow::anyhow!("Unexpected error at get sheet");
}
}
writer::xlsx::write(&xlsx_book, xlsx_path)?;
Ok(())
}
pub fn write_csv_as_xlsx_with_sheet_name(xlsx_path: impl AsRef<Path>,sheet_name:impl ToString,csv_data:Vec<Vec<String>>)->anyhow::Result<()>{

@@ -98,2 +139,4 @@ use crate::xlsx;

for (c_index,val) in row.iter().enumerate(){
let (col_name,_) = position_to_coordinate_tuple(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;
sheet.get_column_dimension_mut(&col_name).set_auto_width(true);
let coordinate = position_to_coordinate(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;

@@ -116,2 +159,4 @@ let mut cell = sheet.get_cell_value_mut(coordinate.to_string());

for (c_index,val) in row.iter().enumerate(){
let (col_name,_) = position_to_coordinate_tuple(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;
sheet.get_column_dimension_mut(&col_name).set_auto_width(true);
let coordinate = position_to_coordinate(c_index, r_index).context("Unexpected error at position_to_coordinate")?;

@@ -132,2 +177,4 @@ let mut cell = sheet.get_cell_value_mut(coordinate.to_string());

for (c_index,val) in row.iter().enumerate(){
let (col_name,_) = position_to_coordinate_tuple(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;
sheet.get_column_dimension_mut(&col_name).set_auto_width(true);
let coordinate = position_to_coordinate(c_index+1, r_index+1).context("Unexpected error at position_to_coordinate")?;

@@ -241,2 +288,17 @@ let mut cell = sheet.get_cell_value_mut(coordinate.to_string());

}
pub fn position_to_coordinate_tuple(x: usize, y: usize) -> Option<(String,String)> {
if x >= 1 && y >= 1 {
let mut num = x;
let mut col_name = String::new();
while num > 0 {
let rem = (num - 1) % 26;
col_name.insert(0, ((rem as u8) + b'A') as char);
num = (num - 1) / 26;
}
Some((format!("{}", col_name),format!("{}", y)))
} else {
None
}
}
///xlsx_get_sheet_names

@@ -243,0 +305,0 @@ ///```ignore

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet