Skip to content

Commit

Permalink
Fixing bug with string data that doesn't use sharedStrings.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
ktr committed Jul 24, 2021
1 parent d45a185 commit 2d1feca
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "xl"
version = "0.1.3"
version = "0.1.4"
edition = "2018"
license = "MIT"
description = "A package to let you process *big* Excel files very quickly"
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ pub fn run(config: Config) -> Result<(), String> {
pub fn usage() {
println!(concat!(
"\n",
"xlcat 0.1.3\n",
"xlcat 0.1.4\n",
"Kevin Ryan <[email protected]>\n",
"\n",
"xlcat is like cat, but for Excel files (xlsx files to be precise). You simply\n",
Expand Down
5 changes: 4 additions & 1 deletion src/ws.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,14 +337,17 @@ impl<'a> Iterator for RowIter<'a> {
Ok(Event::Text(ref e)) if in_value => {
c.raw_value = e.unescape_and_decode(&reader).unwrap();
c.value = match &c.cell_type[..] {
"s" | "str" => {
"s" => {
if let Ok(pos) = c.raw_value.parse::<usize>() {
let s = &strings[pos]; // .to_string()
ExcelValue::String(Cow::Borrowed(s))
} else {
ExcelValue::String(Cow::Owned(c.raw_value.clone()))
}
},
"str" => {
ExcelValue::String(Cow::Owned(c.raw_value.clone()))
},
"b" => {
if c.raw_value == "0" {
ExcelValue::Bool(false)
Expand Down

0 comments on commit 2d1feca

Please sign in to comment.