Mercurial > clickerconvert
comparison src/xlsx/xlsxdocument.h @ 1:93d3106bb9a4
Add qt xlsx library
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 22 Mar 2016 10:38:08 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:49cd5cc0b072 | 1:93d3106bb9a4 |
---|---|
1 /**************************************************************************** | |
2 ** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me> | |
3 ** All right reserved. | |
4 ** | |
5 ** Permission is hereby granted, free of charge, to any person obtaining | |
6 ** a copy of this software and associated documentation files (the | |
7 ** "Software"), to deal in the Software without restriction, including | |
8 ** without limitation the rights to use, copy, modify, merge, publish, | |
9 ** distribute, sublicense, and/or sell copies of the Software, and to | |
10 ** permit persons to whom the Software is furnished to do so, subject to | |
11 ** the following conditions: | |
12 ** | |
13 ** The above copyright notice and this permission notice shall be | |
14 ** included in all copies or substantial portions of the Software. | |
15 ** | |
16 ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
17 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
18 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
19 ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
20 ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
21 ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
22 ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
23 ** | |
24 ****************************************************************************/ | |
25 | |
26 #ifndef QXLSX_XLSXDOCUMENT_H | |
27 #define QXLSX_XLSXDOCUMENT_H | |
28 | |
29 #include "xlsxglobal.h" | |
30 #include "xlsxformat.h" | |
31 #include "xlsxworksheet.h" | |
32 #include <QObject> | |
33 #include <QVariant> | |
34 class QIODevice; | |
35 class QImage; | |
36 | |
37 QT_BEGIN_NAMESPACE_XLSX | |
38 | |
39 class Workbook; | |
40 class Cell; | |
41 class CellRange; | |
42 class DataValidation; | |
43 class ConditionalFormatting; | |
44 class Chart; | |
45 class CellReference; | |
46 | |
47 class DocumentPrivate; | |
48 class Q_XLSX_EXPORT Document : public QObject | |
49 { | |
50 Q_OBJECT | |
51 Q_DECLARE_PRIVATE(Document) | |
52 | |
53 public: | |
54 explicit Document(QObject *parent = 0); | |
55 Document(const QString &xlsxName, QObject *parent=0); | |
56 Document(QIODevice *device, QObject *parent=0); | |
57 ~Document(); | |
58 | |
59 bool write(const CellReference &cell, const QVariant &value, const Format &format=Format()); | |
60 bool write(int row, int col, const QVariant &value, const Format &format=Format()); | |
61 QVariant read(const CellReference &cell) const; | |
62 QVariant read(int row, int col) const; | |
63 bool insertImage(int row, int col, const QImage &image); | |
64 Chart *insertChart(int row, int col, const QSize &size); | |
65 bool mergeCells(const CellRange &range, const Format &format=Format()); | |
66 bool unmergeCells(const CellRange &range); | |
67 | |
68 bool setColumnWidth(const CellRange &range, double width); | |
69 bool setColumnFormat(const CellRange &range, const Format &format); | |
70 bool setColumnHidden(const CellRange &range, bool hidden); | |
71 bool setColumnWidth(int column, double width); | |
72 bool setColumnFormat(int column, const Format &format); | |
73 bool setColumnHidden(int column, bool hidden); | |
74 bool setColumnWidth(int colFirst, int colLast, double width); | |
75 bool setColumnFormat(int colFirst, int colLast, const Format &format); | |
76 bool setColumnHidden(int colFirst, int colLast, bool hidden); | |
77 double columnWidth(int column); | |
78 Format columnFormat(int column); | |
79 bool isColumnHidden(int column); | |
80 | |
81 bool setRowHeight(int row, double height); | |
82 bool setRowFormat(int row, const Format &format); | |
83 bool setRowHidden(int row, bool hidden); | |
84 bool setRowHeight(int rowFirst, int rowLast, double height); | |
85 bool setRowFormat(int rowFirst, int rowLast, const Format &format); | |
86 bool setRowHidden(int rowFirst, int rowLast, bool hidden); | |
87 | |
88 double rowHeight(int row); | |
89 Format rowFormat(int row); | |
90 bool isRowHidden(int row); | |
91 | |
92 bool groupRows(int rowFirst, int rowLast, bool collapsed = true); | |
93 bool groupColumns(int colFirst, int colLast, bool collapsed = true); | |
94 bool addDataValidation(const DataValidation &validation); | |
95 bool addConditionalFormatting(const ConditionalFormatting &cf); | |
96 | |
97 Cell *cellAt(const CellReference &cell) const; | |
98 Cell *cellAt(int row, int col) const; | |
99 | |
100 bool defineName(const QString &name, const QString &formula, const QString &comment=QString(), const QString &scope=QString()); | |
101 | |
102 CellRange dimension() const; | |
103 | |
104 QString documentProperty(const QString &name) const; | |
105 void setDocumentProperty(const QString &name, const QString &property); | |
106 QStringList documentPropertyNames() const; | |
107 | |
108 QStringList sheetNames() const; | |
109 bool addSheet(const QString &name = QString(), AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet); | |
110 bool insertSheet(int index, const QString &name = QString(), AbstractSheet::SheetType type = AbstractSheet::ST_WorkSheet); | |
111 bool selectSheet(const QString &name); | |
112 bool renameSheet(const QString &oldName, const QString &newName); | |
113 bool copySheet(const QString &srcName, const QString &distName = QString()); | |
114 bool moveSheet(const QString &srcName, int distIndex); | |
115 bool deleteSheet(const QString &name); | |
116 | |
117 Workbook *workbook() const; | |
118 AbstractSheet *sheet(const QString &sheetName) const; | |
119 AbstractSheet *currentSheet() const; | |
120 Worksheet *currentWorksheet() const; | |
121 | |
122 bool save() const; | |
123 bool saveAs(const QString &xlsXname) const; | |
124 bool saveAs(QIODevice *device) const; | |
125 | |
126 private: | |
127 Q_DISABLE_COPY(Document) | |
128 DocumentPrivate * const d_ptr; | |
129 }; | |
130 | |
131 QT_END_NAMESPACE_XLSX | |
132 | |
133 #endif // QXLSX_XLSXDOCUMENT_H |