From 0d62f7a447b5cbeee6ff980ddea6aff2fd637232 Mon Sep 17 00:00:00 2001 From: Marc Schreiber Date: Wed, 18 Sep 2024 19:02:15 +0200 Subject: [PATCH] Ignore Annotations With this commit annotations will be ignore in the parsing process to make sure the actual values will be returned only. --- src/ods.rs | 9 +++++++++ tests/test.rs | 7 +++++++ tests/with-annotation.ods | Bin 0 -> 9140 bytes 3 files changed, 16 insertions(+) create mode 100644 tests/with-annotation.ods diff --git a/src/ods.rs b/src/ods.rs index 19459e9..599dcb6 100644 --- a/src/ods.rs +++ b/src/ods.rs @@ -616,6 +616,15 @@ fn get_datatype( { return Ok((Data::String(s), formula, true)); } + Ok(Event::Start(ref e)) if e.name() == QName(b"office:annotation") => loop { + match reader.read_event_into(buf) { + Ok(Event::End(ref e)) if e.name() == QName(b"office:annotation") => { + break; + } + Err(e) => return Err(OdsError::Xml(e)), + _ => (), + } + }, Ok(Event::Start(ref e)) if e.name() == QName(b"text:p") => { if first_paragraph { first_paragraph = false; diff --git a/tests/test.rs b/tests/test.rs index 7a4d7dc..13077d5 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1822,3 +1822,10 @@ fn issue_repeated_empty(#[case] fixture_path: &str) { ] ); } + +#[test] +fn ods_with_annotations() { + let mut ods: Ods<_> = wb("with-annotation.ods"); + let range = ods.worksheet_range("table1").unwrap(); + range_eq!(range, [[String("cell a.1".to_string())],]); +} diff --git a/tests/with-annotation.ods b/tests/with-annotation.ods new file mode 100644 index 0000000000000000000000000000000000000000..d4ac2858f3d9741bd3655790c74dcf78baf40c3f GIT binary patch literal 9140 zcmb7J1z1$w)~34~1Svs6KpF(38-^MLq+{qFIz&oZQo5S~85-#lknWZc1OzETQeb|# z_j=Xu>i6Hf<~h&oJ?E@;fq9B%ez><-3YD=@o*Bgo#&!PM0bWbeWbc60_An}IDsAQ#nN zFmGV~O=LGCNe6p#D+^cWf1rW6IBvLIO^ls6{>(-B8!ks@2McEq82tB~6u;wiaCCLN z75X<4f45F^TL)to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