SpreadsheetCsv.h header
#include <ew/app/SpreadsheetCsv.h>
Namespace ew::app
Functions
ew::core::spreadsheet::SpreadsheetGrid ew::app::spreadsheet::parseDelimitedText(const QString &text, QChar separator=QChar(','))
Parses CSV (or, with separator '\t', TSV) text into a grid of literal cells: one cell per non-empty field, with the dimensions covering the parsed rows and columns. Quoted fields (with doubled inner quotes) and CRLF or LF line endings are handled.
A file with more rows or columns than a project can hold is cut short at ew::core::spreadsheet::kMaxGridRows / kMaxGridColumns and the returned grid's truncated flag is set, so the caller can tell the writer. Without the bound the sheet would look complete and lose everything past those limits the next time the project was opened, since the store clamps to the same limits on load – data loss with no symptom until it was too late to notice.
QString ew::app::spreadsheet::spreadsheetToCsv(const ew::core::spreadsheet::Spreadsheet &sheet, QChar separator=QChar(','))
Serializes sheet to delimited text (RFC 4180 CSV with the default separator ',', or TSV with '\t') using each cell's evaluated (displayed) value, so the export carries computed results. The output covers the used rectangle bounded to the sheet's visible grid – a cell outside rowCount x columnCount is not part of the sheet the writer sees and is excluded, which also keeps one stray coordinate in a corrupt project from densifying a multi-billion-cell rectangle. Fields containing the separator, a quote, or a newline are quoted with doubled inner quotes. An empty sheet yields an empty string.