EHM DAL 0.2.3
Data abstraction layer for Eastside Hockey Manager
Loading...
Searching...
No Matches
spreadsheet_file_xlsx.h
1#pragma once
2
3// Application headers
4#include "xlsxdocument.h"
5#include "include/spreadsheet/private/spreadsheet_file.h"
6
7namespace ehm_dal::spreadsheet {
8
9// --- Excel XLSX spreadsheet --- //
11{
12public:
13 // Constructor
15 SpreadsheetFileXlsx(QFile &file, const QString &file_name);
16
17 // Excel functions
18 qint64 dateToExcelNumber(const QDate &d) const;
19
20 // File I/O
21 bool read(std::vector<std::vector<QVariant>> &header,
22 std::vector<std::vector<QVariant>> &cells,
23 const qint32 header_count = 0) override;
24 bool writeCells(std::vector<QVariant> &prefix,
25 std::vector<std::vector<QVariant>> &cells) override;
26 bool writeHeader(std::vector<QVariant> &prefix,
27 std::vector<std::vector<QVariant>> &header) override;
28
29private:
30 // File path (for QXlsx which cannot use the device)
31 QString file_name_;
32
33 // File I/O
34 void readRow(std::vector<std::vector<QVariant>> &data,
35 const qint32 row,
36 const qint32 column_count);
37 bool write(std::vector<QVariant> &prefix,
38 std::vector<std::vector<QVariant>> &data,
39 const QXlsx::Format &format,
40 const bool silent_progress_dialog = false);
41 void writeCell(qint32 row,
42 qint32 column,
43 const QVariant &data,
44 QXlsx::Worksheet *w,
45 const QXlsx::Format &standard_format,
46 const QXlsx::Format &date_format);
47
48 // Row offset counter
49 qint32 row_offset_{0};
50
51 // Xlsx document
52 std::unique_ptr<QXlsx::Document> xlsx_;
53
54 static const QDate excel_epoch_;
55};
56} // namespace ehm_dal::spreadsheet
Definition: spreadsheet_file.h:17
Definition: spreadsheet_file_xlsx.h:11