fix: xlsx cell parsing, now returning values instead of formulas (#2520)

* fix: xlsx doc parsing, now returning values instead of formulas

Signed-off-by: glypt <8trash-can8@protonmail.ch>

* fix: add test for better coverage of xlsx backend

Signed-off-by: glypt <8trash-can8@protonmail.ch>

* fix: add the total of ducks as a formula in the tests/data

This also adds the test that the value 310 is contained in the table.
Without the fix from the previous commit, it would return "B7+C7"

Signed-off-by: glypt <8trash-can8@protonmail.ch>

---------

Signed-off-by: glypt <8trash-can8@protonmail.ch>
This commit is contained in:
glypt
2025-10-29 11:35:51 +01:00
committed by GitHub
parent b6c892b505
commit d9c90eb45e
6 changed files with 291 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
item-0 at level 0: unspecified: group _root_
item-1 at level 1: section: group sheet: Duck Observations
item-2 at level 2: table with [7x3]
item-2 at level 2: table with [7x4]
item-3 at level 1: section: group sheet: Duck Chart

View File

@@ -71,7 +71,7 @@
"bbox": {
"l": 0.0,
"t": 0.0,
"r": 3.0,
"r": 4.0,
"b": 7.0,
"coord_origin": "TOPLEFT"
},
@@ -125,6 +125,19 @@
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 0,
"end_row_offset_idx": 1,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "Ducks",
"column_header": true,
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
@@ -164,6 +177,19 @@
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 1,
"end_row_offset_idx": 2,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "200",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
@@ -203,6 +229,19 @@
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 2,
"end_row_offset_idx": 3,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "230",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
@@ -242,6 +281,19 @@
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 3,
"end_row_offset_idx": 4,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "250",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
@@ -281,6 +333,19 @@
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 4,
"end_row_offset_idx": 5,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "280",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
@@ -320,6 +385,19 @@
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 5,
"end_row_offset_idx": 6,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "280",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
@@ -358,10 +436,23 @@
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 6,
"end_row_offset_idx": 7,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "310",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
}
],
"num_rows": 7,
"num_cols": 3,
"num_cols": 4,
"grid": [
[
{
@@ -402,6 +493,19 @@
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 0,
"end_row_offset_idx": 1,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "Ducks",
"column_header": true,
"row_header": false,
"row_section": false,
"fillable": false
}
],
[
@@ -443,6 +547,19 @@
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 1,
"end_row_offset_idx": 2,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "200",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
}
],
[
@@ -484,6 +601,19 @@
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 2,
"end_row_offset_idx": 3,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "230",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
}
],
[
@@ -525,6 +655,19 @@
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 3,
"end_row_offset_idx": 4,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "250",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
}
],
[
@@ -566,6 +709,19 @@
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 4,
"end_row_offset_idx": 5,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "280",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
}
],
[
@@ -607,6 +763,19 @@
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 5,
"end_row_offset_idx": 6,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "280",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
}
],
[
@@ -648,6 +817,19 @@
"row_header": false,
"row_section": false,
"fillable": false
},
{
"row_span": 1,
"col_span": 1,
"start_row_offset_idx": 6,
"end_row_offset_idx": 7,
"start_col_offset_idx": 3,
"end_col_offset_idx": 4,
"text": "310",
"column_header": false,
"row_header": false,
"row_section": false,
"fillable": false
}
]
]
@@ -660,7 +842,7 @@
"pages": {
"1": {
"size": {
"width": 3.0,
"width": 4.0,
"height": 7.0
},
"page_no": 1
@@ -673,4 +855,4 @@
"page_no": 2
}
}
}
}

View File

@@ -1,8 +1,8 @@
| Year | Freshwater Ducks | Saltwater Ducks |
|--------|--------------------|-------------------|
| 2019 | 120 | 80 |
| 2020 | 135 | 95 |
| 2021 | 150 | 100 |
| 2022 | 170 | 110 |
| 2023 | 160 | 120 |
| 2024 | 180 | 130 |
| Year | Freshwater Ducks | Saltwater Ducks | Ducks |
|--------|--------------------|-------------------|---------|
| 2019 | 120 | 80 | 200 |
| 2020 | 135 | 95 | 230 |
| 2021 | 150 | 100 | 250 |
| 2022 | 170 | 110 | 280 |
| 2023 | 160 | 120 | 280 |
| 2024 | 180 | 130 | 310 |

Binary file not shown.