-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxo.h
126 lines (103 loc) · 4.06 KB
/
xo.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* gSAFE - LIB
general Sql dAtabase FrontEnd
http://hyperprog.com/gsafe/
(C) 2005-2024 Péter Deák (hyper80@gmail.com)
License: Apache 2.0
xo.h
*/
#ifndef GSAFE__XO_HEADER_FILE_X_
#define GSAFE__XO_HEADER_FILE_X_
#include <QtCore>
/* @{ */
enum HDMtrxAdd_TypeHint {
HDMtrxAdd_Auto = 0,
HDMtrxAdd_String = 1,
HDMtrxAdd_Numeric = 2,
};
class HDataMatrix;
/**
* Class ExcelXmlDocument generate an Excel XML Spreadsheet
* cell,cells and nrow function can be used to build a formatted table
* The cell,cells,head,heads,nrow functions can receive an options string which is tell the formatting of the cell(s).
* This option string is built from options which separated by ;
*
* height=NUMBER - The height of the cell's row
* width=NUMBER - The width of the cell's row
* formula=STRING - Specify a formula to the cell
* Examples: "RC[-1]*2" - Same row 1 column less * 2
* "R[-1]C*2" - Same column 1 row less * 2
* "R3C3*2" - Absolute row 3 column 3 * 2
* t=str|num|dat - The type of the cell
* str - String
* num - Number
* dat - Date, also specify the numberformat => "Short Date" and give the data in iso date yyyy-MM-dd!
* wrap=on|off - Cell wrapping on or off
* vertical=top|center|bottom - Vertical align of the cell
* horizontal=left|center|right - Horizontal align of the cell
* border=[none|all|top|bottom|left|right] - Borders of the cell. Can be a simple text value or more value separated by ,
* Examples: "border=all"
* "border=top,left"
* "border=none"
* borderweight=0|1|2|3 - Border width
* background-color=#RRGGBB - The background color of the cell
* strong=yes - Bold font
* italic=yes - Italic font
* size=XX - Point size of the font
* underline=yes - The font will be underlined
* color=#RRGGBB - The color of the font
* numberformat=STRING - The format of the numbers "#,##0\ "Ft";[Red]\-#,##0\ "Ft""
* prefix=STRING
* suffix=STRING
*
* Examples for complete option string:
* "t=num;border=all;size=14;formula= "
* "border=all ; italic=yes ; size=18 "
* "background-color=#ff4455 ; strong=yes ; size=18 ; width=140"
*/
class HExcelXmlDocument
{
public:
HExcelXmlDocument(QString docName = "Generated document");
~HExcelXmlDocument();
QString name(void);
HExcelXmlDocument* setDocumentName(QString docName);
HExcelXmlDocument* setTitle(QString title);
HExcelXmlDocument* opts(QString options = "");
HExcelXmlDocument* nrow(QString options = "");
HExcelXmlDocument* nrows(int count = 1,QString options = "");
void addDataMatrix(HDataMatrix *dm,HDMtrxAdd_TypeHint typeHint = HDMtrxAdd_Auto,bool controlRowAsOptions = false,QString options = "");
HExcelXmlDocument* cell(QString c,QString options = "");
HExcelXmlDocument* cells(QList<QString> cs,QString options = "");
HExcelXmlDocument* head(QString h,QString options = "");
HExcelXmlDocument* heads(QList<QString> hs,QString options = "");
HExcelXmlDocument* setOrientationLandscape();
HExcelXmlDocument* setOrientationPortrait();
bool writeFile(QString filename);
QString get();
static QMap<QString,QString> optionStringToMap(QString optionString,QString mainSeparator = ";");
static void mergeMapIntoMap(QMap<QString,QString>& mergeInto ,const QMap<QString,QString>& toMerge);
protected:
HExcelXmlDocument* beginRow(QString options = "");
HExcelXmlDocument* endRow();
QString styleId(QString options);
QString styleId(const QMap<QString,QString>& opts);
protected:
QString doc_body;
int colcount,rowcount;
bool r_open,r_empty,in_header_row;
int hc_cc; // header|cell, 0-no 1-header 2-cell
QString row_body;
QMap<QString,QString> table_opts;
QMap<QString,QString> row_opts;
int row_height;
int c_index;
bool c_emptycellbefore;
QMap<int,int> column_width;
QString document_name;
QString orientation;
int style_counter;
QMap<QString,QString> processedStyles;
};
/* @} */
#endif
//End of gSAFE xo.h