From 344888ceb583ebb4433f8dcc036892b9fa9f3861 Mon Sep 17 00:00:00 2001 From: MarekSpodBiedry <73122968+MarekSpodBiedry@users.noreply.github.com> Date: Mon, 12 Oct 2026 08:32:20 +0200 Subject: [PATCH] Keep every range of a conditional format or validation sqref (#512) --- crates/xlsx/src/sheet_read.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/xlsx/src/sheet_read.rs b/crates/xlsx/src/sheet_read.rs index 77b46d9..e7019a4 100644 --- a/crates/xlsx/src/sheet_read.rs +++ b/crates/xlsx/src/sheet_read.rs @@ -541,7 +541,7 @@ pub fn parse_iso_datetime(s: &str, sys: DateSystem) -> Option { } pub fn parse_sqref(s: Option<&str>) -> Vec { - s.unwrap_or("").split_whitespace().filter_map(RangeRef::parse).take(10_000).collect() + s.unwrap_or("").split_whitespace().filter_map(RangeRef::parse).collect() } fn cf_op(s: Option<&str>) -> CfOperator { @@ -973,4 +973,12 @@ mod tests { assert_eq!(parse_iso_datetime("garbage", DateSystem::D1900), None); assert_eq!(parse_iso_datetime("2024-13-01", DateSystem::D1900), None); } + + #[test] + fn sqref_keeps_more_than_ten_thousand_ranges() { + let sq = (1..=12_000).map(|r| format!("A{r}")).collect::>().join(" "); + let ranges = parse_sqref(Some(&sq)); + assert_eq!(ranges.len(), 12_000); + assert_eq!(ranges.last().copied(), RangeRef::parse("A12000")); + } }