diff --git a/crates/xlsx/src/sheet_read.rs b/crates/xlsx/src/sheet_read.rs index 0194d2268..83f8d0d91 100644 --- a/crates/xlsx/src/sheet_read.rs +++ b/crates/xlsx/src/sheet_read.rs @@ -324,8 +324,8 @@ fn read_cols(cx: &Ctx<'_>, e: &El, sheet: &mut Sheet) { info.style = Some(id); } } - // A width equal to the default with nothing else set is noise. - if info == LineInfo::default() || (info.size == Some(sheet.default_col_width) && LineInfo { size: None, ..info } == LineInfo::default()) { + // A custom width equal to the default still pins the column (Standard Width leaves it alone). + if info == LineInfo::default() { continue; } for col in (min - 1)..max { diff --git a/crates/xlsx/src/tests/fixtures.rs b/crates/xlsx/src/tests/fixtures.rs index 39ea30951..4ca580a5b 100644 --- a/crates/xlsx/src/tests/fixtures.rs +++ b/crates/xlsx/src/tests/fixtures.rs @@ -577,3 +577,25 @@ fn user_defined_function_prefix_round_trips() { assert_eq!(cell.child("f").unwrap().text, f, "written {a}"); } } + +/// `customWidth="1"` pins a column even when its width rounds to the default: Standard Width does not +/// move it, and a save must keep its `