1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:47:44 +00:00

Spreadsheet: Save the cells under the correct name

This broke in 6a6f19a72f, which replaced
the representation of columns with numbers.
As a result, the save logic would store cells as
"\x<column_index><row_number>", which is obviously wrong.
Fixes #5905.
Also simplifies the control flow in `import_worksheet` a bit.
This commit is contained in:
AnotherTest 2021-03-22 17:03:22 +04:30 committed by Andreas Kling
parent 7b4fa860d2
commit 534626f917
2 changed files with 3 additions and 6 deletions

View file

@ -244,11 +244,8 @@ Result<NonnullRefPtrVector<Sheet>, String> ImportDialog::make_and_run_for(String
if (!sheet_json.is_object())
return IterationDecision::Continue;
auto sheet = Sheet::from_json(sheet_json.as_object(), workbook);
if (!sheet)
return IterationDecision::Continue;
sheets.append(sheet.release_nonnull());
if (auto sheet = Sheet::from_json(sheet_json.as_object(), workbook))
sheets.append(sheet.release_nonnull());
return IterationDecision::Continue;
});

View file

@ -544,7 +544,7 @@ JsonObject Sheet::to_json() const
JsonObject cells;
for (auto& it : m_cells) {
StringBuilder builder;
builder.append(it.key.column);
builder.append(column(it.key.column));
builder.appendff("{}", it.key.row);
auto key = builder.to_string();