File tree Expand file tree Collapse file tree 4 files changed +85
-0
lines changed Expand file tree Collapse file tree 4 files changed +85
-0
lines changed Original file line number Diff line number Diff line change
1
+ # ReadColor.pro
2
+
3
+ TARGET = ReadColor
4
+ TEMPLATE = app
5
+
6
+ QT += core
7
+
8
+ CONFIG += console
9
+ CONFIG -= app_bundle
10
+
11
+ DEFINES += QT_DEPRECATED_WARNINGS
12
+
13
+ # #########################################################################
14
+ # NOTE: You can fix value of QXlsx path of source code.
15
+ # QXLSX_PARENTPATH=./
16
+ # QXLSX_HEADERPATH=./header/
17
+ # QXLSX_SOURCEPATH=./source/
18
+ include (../QXlsx/QXlsx.pri )
19
+
20
+ SOURCES += main.cpp
21
+
22
+ RESOURCES += color.qrc
23
+
Original file line number Diff line number Diff line change
1
+ <RCC>
2
+ <qresource prefix="/">
3
+ <file>color.xlsx</file>
4
+ </qresource>
5
+ </RCC>
Original file line number Diff line number Diff line change
1
+ // main.cpp
2
+
3
+ #include < QtGlobal>
4
+ #include < QCoreApplication>
5
+ #include < QtCore>
6
+ #include < QVariant>
7
+ #include < QDir>
8
+ #include < QColor>
9
+ #include < QDebug>
10
+
11
+ #include < iostream>
12
+ using namespace std ;
13
+
14
+ #include " xlsxdocument.h"
15
+ #include " xlsxchartsheet.h"
16
+ #include " xlsxcellrange.h"
17
+ #include " xlsxchart.h"
18
+ #include " xlsxrichstring.h"
19
+ #include " xlsxworkbook.h"
20
+ using namespace QXlsx ;
21
+
22
+ void printColor (Cell* cell);
23
+
24
+ int main (int argc, char *argv[])
25
+ {
26
+ QCoreApplication app (argc, argv);
27
+
28
+ Document xlsxR (" :/color.xlsx" );
29
+ if ( !xlsxR.load () )
30
+ {
31
+ return (-1 );
32
+ }
33
+
34
+ printColor ( xlsxR.cellAt (1 , 1 ) );
35
+ printColor ( xlsxR.cellAt (1 , 2 ) );
36
+ printColor ( xlsxR.cellAt (2 , 1 ) );
37
+ printColor ( xlsxR.cellAt (2 , 2 ) );
38
+
39
+ return 0 ;
40
+ }
41
+
42
+ void printColor (Cell* cell)
43
+ {
44
+ if ( NULL == cell )
45
+ return ;
46
+
47
+ QColor clrForeGround = cell->format ().patternForegroundColor ();
48
+ QColor clrBackGround = cell->format ().patternBackgroundColor ();
49
+
50
+ if ( clrForeGround.isValid () &&
51
+ clrBackGround.isValid () )
52
+ {
53
+ qDebug () << " [debug] color : " << clrForeGround << clrBackGround;
54
+ }
55
+
56
+
57
+ }
You can’t perform that action at this time.
0 commit comments