Skip to content

Commit

Permalink
Ignore Annotations
Browse files Browse the repository at this point in the history
With this commit annotations will be ignore in the parsing process to
make sure the actual values will be returned only.
  • Loading branch information
schrieveslaach committed Sep 18, 2024
1 parent 247c080 commit 0d62f7a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/ods.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 7 additions & 0 deletions tests/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())],]);
}
Binary file added tests/with-annotation.ods
Binary file not shown.

0 comments on commit 0d62f7a

Please sign in to comment.