Skip to content

Commit

Permalink
🐛 Fix the bug of old formula.
Browse files Browse the repository at this point in the history
  • Loading branch information
mortalreminder committed Apr 7, 2024
1 parent e49fc8e commit 455968a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/xml/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ impl Default for Metadata {
Self {
xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main".to_string(),
xmlns_xda: "http://schemas.microsoft.com/office/spreadsheetml/2017/dynamicarray".to_string(),
metadata_types: Default::default(),
metadata_types: Some(Default::default()),
future_metadata: Default::default(),
cell_metadata: Default::default(),
cell_metadata: Some(Default::default()),
}
}
}
Expand Down
16 changes: 12 additions & 4 deletions src/xml/worksheet/sheet_data/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,19 @@ impl Cell {
}

pub(crate) fn update_by_formula(&mut self, formula: &str, formula_type: FormulaType, style: Option<u32>) {
let formula = Formula::from_formula_type(formula, formula_type);
self.formula = Some(formula);
self.style = style;
self.cell_type = None;
self.cm = None;
self.text = None; // Some(String::from("0"));
match formula_type {
FormulaType::OldFormula(_) => {
self.text = None;
self.cm = None;
},
_ => {
self.text = Some(String::from("0"));
self.cm = Some(1);
},
};
let formula = Formula::from_formula_type(formula, formula_type);
self.formula = Some(formula);
}
}

0 comments on commit 455968a

Please sign in to comment.