Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
DESKTOP-U434MT0\hiro committed Feb 28, 2024
1 parent f5ab08c commit 48430a4
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "umya-spreadsheet"
version = "1.2.0"
version = "1.2.1"
authors = ["MathNya <[email protected]>"]
repository = "https://github.com/MathNya/umya-spreadsheet"
keywords = ["excel", "spreadsheet", "xlsx", "reader", "writer"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ assert_eq!("03-Feb-24", result);
Add the following code to Cargo.toml
```toml
[dependencies]
umya-spreadsheet = "1.2.0"
umya-spreadsheet = "1.2.1"
```
Add the following code to main.rs
```rust
Expand Down
3 changes: 2 additions & 1 deletion src/structs/columns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ impl Columns {
offset_col_num: &u32,
) {
self.get_column_collection_mut().retain(|x| {
!(x.get_col_num() > root_col_num && x.get_col_num() < &(root_col_num + offset_col_num))
!(x.get_col_num() >= root_col_num
&& x.get_col_num() <= &(root_col_num + offset_col_num))
});
for column_dimension in self.get_column_collection_mut() {
column_dimension.adjustment_remove_coordinate(root_col_num, offset_col_num);
Expand Down
5 changes: 3 additions & 2 deletions src/structs/rows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,9 @@ impl Rows {
root_row_num: &u32,
offset_row_num: &u32,
) {
self.get_row_dimensions_mut().retain(|k| {
!(k.get_row_num() > root_row_num && k.get_row_num() < &(root_row_num + offset_row_num))
self.get_row_dimensions_to_hashmap_mut().retain(|_, k| {
!(k.get_row_num() >= root_row_num
&& k.get_row_num() <= &(root_row_num + offset_row_num))
});
for row_dimension in self.get_row_dimensions_mut() {
row_dimension.adjustment_remove_coordinate(root_row_num, offset_row_num);
Expand Down
15 changes: 15 additions & 0 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1332,3 +1332,18 @@ fn issue_178() {
let path = std::path::Path::new("./tests/result_files/issue_178.xlsx");
let _ = umya_spreadsheet::writer::xlsx::write(&book, path);
}

#[test]
fn issue_181() {
let path = std::path::Path::new("./tests/test_files/issue_181.xlsx");
let mut book = umya_spreadsheet::reader::xlsx::read(path).unwrap();
let mut sheet = book.get_sheet_by_name_mut("LOV").unwrap();
sheet.remove_row(&2, &1);
for (key, row) in sheet.get_row_dimensions_to_hashmap() {
assert_eq!(key, &1);
assert_eq!(row.get_row_num(), &1);
assert_eq!(row.get_height(), &35.0);
}
let path = std::path::Path::new("./tests/result_files/issue_181.xlsx");
let _ = umya_spreadsheet::writer::xlsx::write(&book, path);
}
Binary file added tests/test_files/issue_181.xlsx
Binary file not shown.

0 comments on commit 48430a4

Please sign in to comment.