mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-18 15:32:22 +00:00
Spreadsheet: Add an import wizard, and add support for custom CSV files
Fixes the import half of #4269.
This commit is contained in:
parent
3bbcde9192
commit
3c151b3de6
Notes:
sideshowbarker
2024-07-18 21:10:14 +09:00
Author: https://github.com/alimpfard
Commit: 3c151b3de6
Pull-request: https://github.com/SerenityOS/serenity/pull/5866
Issue: https://github.com/SerenityOS/serenity/issues/4269
Issue: https://github.com/SerenityOS/serenity/issues/4821
Issue: https://github.com/SerenityOS/serenity/issues/5550
Reviewed-by: https://github.com/awesomekling
7 changed files with 601 additions and 52 deletions
|
@ -636,7 +636,13 @@ RefPtr<Sheet> Sheet::from_xsv(const Reader::XSV& xsv, Workbook& workbook)
|
|||
auto rows = xsv.size();
|
||||
|
||||
auto sheet = adopt(*new Sheet(workbook));
|
||||
sheet->m_columns = cols;
|
||||
if (xsv.has_explicit_headers()) {
|
||||
sheet->m_columns = cols;
|
||||
} else {
|
||||
sheet->m_columns.ensure_capacity(cols.size());
|
||||
for (size_t i = 0; i < cols.size(); ++i)
|
||||
sheet->m_columns.append(convert_to_string(i));
|
||||
}
|
||||
for (size_t i = 0; i < max(rows, Sheet::default_row_count); ++i)
|
||||
sheet->add_row();
|
||||
if (sheet->columns_are_standard()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue