mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 09:18:05 +03:00
Spreadsheet: Save and load cell alignment
This commit is contained in:
parent
f2cc067c9b
commit
0a7efb7d7b
Notes:
sideshowbarker
2024-07-18 05:06:11 +09:00
Author: https://github.com/Mandar12 Commit: https://github.com/SerenityOS/serenity/commit/0a7efb7d7b8 Pull-request: https://github.com/SerenityOS/serenity/pull/9671 Reviewed-by: https://github.com/alimpfard
@ -416,6 +416,11 @@ RefPtr<Sheet> Sheet::from_json(const JsonObject& object, Workbook& workbook)
|
||||
meta.length = value.to_i32();
|
||||
if (auto value = meta_obj.get("format"); value.is_string())
|
||||
meta.format = value.as_string();
|
||||
if (auto value = meta_obj.get("alignment"); value.is_string()) {
|
||||
auto alignment = Gfx::text_alignment_from_string(value.as_string());
|
||||
if (alignment.has_value())
|
||||
meta.alignment = alignment.value();
|
||||
}
|
||||
read_format(meta.static_format, meta_obj);
|
||||
|
||||
cell->set_type_metadata(move(meta));
|
||||
@ -535,9 +540,7 @@ JsonObject Sheet::to_json() const
|
||||
JsonObject metadata_object;
|
||||
metadata_object.set("length", meta.length);
|
||||
metadata_object.set("format", meta.format);
|
||||
#if 0
|
||||
metadata_object.set("alignment", alignment_to_string(meta.alignment));
|
||||
#endif
|
||||
metadata_object.set("alignment", Gfx::to_string(meta.alignment));
|
||||
save_format(meta.static_format, metadata_object);
|
||||
|
||||
data.set("type_metadata", move(metadata_object));
|
||||
|
Loading…
Reference in New Issue
Block a user