FIX: There are two fills in every new Excel model
Excel expects two default fills. If a different fill is present Excel removes it and substitutes it with the defaults. This resulted in models having the default fill for the first style. Thanks @scandel!
This commit is contained in:
committed by
Nicolás Hatcher Andrés
parent
af49d7ad96
commit
b9d3f5329b
@@ -62,3 +62,17 @@ fn test_create_named_style() {
|
|||||||
let style = model.get_style_for_cell(0, 1, 1).unwrap();
|
let style = model.get_style_for_cell(0, 1, 1).unwrap();
|
||||||
assert!(style.font.b);
|
assert!(style.font.b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn empty_models_have_two_fills() {
|
||||||
|
let model = new_empty_model();
|
||||||
|
assert_eq!(model.workbook.styles.fills.len(), 2);
|
||||||
|
assert_eq!(
|
||||||
|
model.workbook.styles.fills[0].pattern_type,
|
||||||
|
"none".to_string()
|
||||||
|
);
|
||||||
|
assert_eq!(
|
||||||
|
model.workbook.styles.fills[1].pattern_type,
|
||||||
|
"gray125".to_string()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -303,7 +303,14 @@ impl Default for Styles {
|
|||||||
Styles {
|
Styles {
|
||||||
num_fmts: vec![],
|
num_fmts: vec![],
|
||||||
fonts: vec![Default::default()],
|
fonts: vec![Default::default()],
|
||||||
fills: vec![Default::default()],
|
fills: vec![
|
||||||
|
Default::default(),
|
||||||
|
Fill {
|
||||||
|
pattern_type: "gray125".to_string(),
|
||||||
|
fg_color: None,
|
||||||
|
bg_color: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
borders: vec![Default::default()],
|
borders: vec![Default::default()],
|
||||||
cell_style_xfs: vec![Default::default()],
|
cell_style_xfs: vec![Default::default()],
|
||||||
cell_xfs: vec![Default::default()],
|
cell_xfs: vec![Default::default()],
|
||||||
|
|||||||
Reference in New Issue
Block a user