From 534626f917f90402b5d86f9e6562fa961a2eb034 Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Mon, 22 Mar 2021 17:03:22 +0430 Subject: [PATCH] Spreadsheet: Save the cells under the correct name This broke in 6a6f19a72fe15c05c39a53fa5be2b4ca3d65edf3, which replaced the representation of columns with numbers. As a result, the save logic would store cells as "\x", which is obviously wrong. Fixes #5905. Also simplifies the control flow in `import_worksheet` a bit. --- Userland/Applications/Spreadsheet/ImportDialog.cpp | 7 ++----- Userland/Applications/Spreadsheet/Spreadsheet.cpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Userland/Applications/Spreadsheet/ImportDialog.cpp b/Userland/Applications/Spreadsheet/ImportDialog.cpp index 1500825d93..39400e41a6 100644 --- a/Userland/Applications/Spreadsheet/ImportDialog.cpp +++ b/Userland/Applications/Spreadsheet/ImportDialog.cpp @@ -244,11 +244,8 @@ Result, 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; }); diff --git a/Userland/Applications/Spreadsheet/Spreadsheet.cpp b/Userland/Applications/Spreadsheet/Spreadsheet.cpp index b3ad9f6c48..66b0888894 100644 --- a/Userland/Applications/Spreadsheet/Spreadsheet.cpp +++ b/Userland/Applications/Spreadsheet/Spreadsheet.cpp @@ -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();