Skip to content

Commit

Permalink
fix columns indexes numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
e-oz committed Jun 8, 2018
1 parent d700d22 commit 85950a1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xlsx_reader"
version = "1.1.0"
version = "1.1.1"
authors = ["OZ <normandiggs@gmail.com>"]
description = "Reader of XLSX files (only data)"
license = "MIT"
Expand Down
14 changes: 12 additions & 2 deletions src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ pub fn get_parsed_xlsx(strings_map: HashMap<usize, String>, sheet_content: Strin
let mut i: usize = 0;
let cells_count = cells["c"].len();
for cell in &cells["c"] {
let mut found = false;
if cell.attributes.contains_key("r") {
let pre_i = i;
while excel_str_cell(ir + 1, i) != cell.attributes["r"][0] {
Expand All @@ -126,7 +127,10 @@ pub fn get_parsed_xlsx(strings_map: HashMap<usize, String>, sheet_content: Strin
}
}
match cell.members {
Content::Text(ref t) => { tr.insert(i, t.clone()); },
Content::Text(ref t) => {
tr.insert(i, t.clone());
found = true;
},
_ => {
if cell.attributes.contains_key("v") {
if cell.attributes.contains_key("t") && cell.attributes["t"][0] == "s" {
Expand All @@ -141,21 +145,27 @@ pub fn get_parsed_xlsx(strings_map: HashMap<usize, String>, sheet_content: Strin
Err(_) => cell.attributes["v"][0].clone()
};
tr.insert(i, val);
found = true;
} else {
if cell.attributes.contains_key("s") && (cell.attributes["s"][0] == "10" || cell.attributes["s"][0] == "14" || cell.attributes["s"][0] == "15") {
tr.insert(i, excel_date(&cell.attributes["v"][0], Some(1462.0)));
found = true;
} else {
if cell.attributes.contains_key("s") && (cell.attributes["s"][0] == "4" || cell.attributes["s"][0] == "3" || cell.attributes["s"][0] == "5") {
tr.insert(i, excel_date(&cell.attributes["v"][0], None));
found = true;
} else {
tr.insert(i, cell.attributes["v"][0].clone());
found = true;
}
}
}
}
}
}
i = i + 1;
if found {
i = i + 1;
}
}
table.insert(ir, tr);
}
Expand Down

0 comments on commit 85950a1

Please sign in to comment.