comparison src/xlsx/xlsxworksheet.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 #ifndef XLSXWORKSHEET_H
26 #define XLSXWORKSHEET_H
27
28 #include "xlsxabstractsheet.h"
29 #include "xlsxcell.h"
30 #include "xlsxcellrange.h"
31 #include "xlsxcellreference.h"
32 #include <QStringList>
33 #include <QMap>
34 #include <QVariant>
35 #include <QPointF>
36 #include <QSharedPointer>
37 class QIODevice;
38 class QDateTime;
39 class QUrl;
40 class QImage;
41 class WorksheetTest;
42
43 QT_BEGIN_NAMESPACE_XLSX
44 class DocumentPrivate;
45 class Workbook;
46 class Format;
47 class Drawing;
48 class DataValidation;
49 class ConditionalFormatting;
50 class CellRange;
51 class RichString;
52 class Relationships;
53 class Chart;
54
55 class WorksheetPrivate;
56 class Q_XLSX_EXPORT Worksheet : public AbstractSheet
57 {
58 Q_DECLARE_PRIVATE(Worksheet)
59 public:
60 bool write(const CellReference &row_column, const QVariant &value, const Format &format=Format());
61 bool write(int row, int column, const QVariant &value, const Format &format=Format());
62 QVariant read(const CellReference &row_column) const;
63 QVariant read(int row, int column) const;
64 bool writeString(const CellReference &row_column, const QString &value, const Format &format=Format());
65 bool writeString(int row, int column, const QString &value, const Format &format=Format());
66 bool writeString(const CellReference &row_column, const RichString &value, const Format &format=Format());
67 bool writeString(int row, int column, const RichString &value, const Format &format=Format());
68 bool writeInlineString(const CellReference &row_column, const QString &value, const Format &format=Format());
69 bool writeInlineString(int row, int column, const QString &value, const Format &format=Format());
70 bool writeNumeric(const CellReference &row_column, double value, const Format &format=Format());
71 bool writeNumeric(int row, int column, double value, const Format &format=Format());
72 bool writeFormula(const CellReference &row_column, const CellFormula &formula, const Format &format=Format(), double result=0);
73 bool writeFormula(int row, int column, const CellFormula &formula, const Format &format=Format(), double result=0);
74 bool writeBlank(const CellReference &row_column, const Format &format=Format());
75 bool writeBlank(int row, int column, const Format &format=Format());
76 bool writeBool(const CellReference &row_column, bool value, const Format &format=Format());
77 bool writeBool(int row, int column, bool value, const Format &format=Format());
78 bool writeDateTime(const CellReference &row_column, const QDateTime& dt, const Format &format=Format());
79 bool writeDateTime(int row, int column, const QDateTime& dt, const Format &format=Format());
80 bool writeTime(const CellReference &row_column, const QTime& t, const Format &format=Format());
81 bool writeTime(int row, int column, const QTime& t, const Format &format=Format());
82
83 bool writeHyperlink(const CellReference &row_column, const QUrl &url, const Format &format=Format(), const QString &display=QString(), const QString &tip=QString());
84 bool writeHyperlink(int row, int column, const QUrl &url, const Format &format=Format(), const QString &display=QString(), const QString &tip=QString());
85
86 bool addDataValidation(const DataValidation &validation);
87 bool addConditionalFormatting(const ConditionalFormatting &cf);
88
89 Cell *cellAt(const CellReference &row_column) const;
90 Cell *cellAt(int row, int column) const;
91
92 bool insertImage(int row, int column, const QImage &image);
93 Chart *insertChart(int row, int column, const QSize &size);
94
95 bool mergeCells(const CellRange &range, const Format &format=Format());
96 bool unmergeCells(const CellRange &range);
97 QList<CellRange> mergedCells() const;
98
99 bool setColumnWidth(const CellRange& range, double width);
100 bool setColumnFormat(const CellRange& range, const Format &format);
101 bool setColumnHidden(const CellRange& range, bool hidden);
102 bool setColumnWidth(int colFirst, int colLast, double width);
103 bool setColumnFormat(int colFirst, int colLast, const Format &format);
104 bool setColumnHidden(int colFirst, int colLast, bool hidden);
105 double columnWidth(int column);
106 Format columnFormat(int column);
107 bool isColumnHidden(int column);
108
109 bool setRowHeight(int rowFirst,int rowLast, double height);
110 bool setRowFormat(int rowFirst,int rowLast, const Format &format);
111 bool setRowHidden(int rowFirst,int rowLast, bool hidden);
112
113 double rowHeight(int row);
114 Format rowFormat(int row);
115 bool isRowHidden(int row);
116
117 bool groupRows(int rowFirst, int rowLast, bool collapsed = true);
118 bool groupColumns(int colFirst, int colLast, bool collapsed = true);
119 bool groupColumns(const CellRange &range, bool collapsed = true);
120 CellRange dimension() const;
121
122 bool isWindowProtected() const;
123 void setWindowProtected(bool protect);
124 bool isFormulasVisible() const;
125 void setFormulasVisible(bool visible);
126 bool isGridLinesVisible() const;
127 void setGridLinesVisible(bool visible);
128 bool isRowColumnHeadersVisible() const;
129 void setRowColumnHeadersVisible(bool visible);
130 bool isZerosVisible() const;
131 void setZerosVisible(bool visible);
132 bool isRightToLeft() const;
133 void setRightToLeft(bool enable);
134 bool isSelected() const;
135 void setSelected(bool select);
136 bool isRulerVisible() const;
137 void setRulerVisible(bool visible);
138 bool isOutlineSymbolsVisible() const;
139 void setOutlineSymbolsVisible(bool visible);
140 bool isWhiteSpaceVisible() const;
141 void setWhiteSpaceVisible(bool visible);
142
143 ~Worksheet();
144
145
146 private:
147 friend class DocumentPrivate;
148 friend class Workbook;
149 friend class ::WorksheetTest;
150 Worksheet(const QString &sheetName, int sheetId, Workbook *book, CreateFlag flag);
151 Worksheet *copy(const QString &distName, int distId) const;
152
153 void saveToXmlFile(QIODevice *device) const;
154 bool loadFromXmlFile(QIODevice *device);
155 };
156
157 QT_END_NAMESPACE_XLSX
158 #endif // XLSXWORKSHEET_H
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)