Add font format support for cell data

This commit is contained in:
Debao Zhang
2013-08-27 10:23:11 +08:00
parent 0ad70e84c9
commit abb991c212
11 changed files with 289 additions and 121 deletions
+3
View File
@@ -1,3 +1,6 @@
TEMPLATE = subdirs
SUBDIRS = hello
SUBDIRS += \
style
+2
View File
@@ -18,6 +18,8 @@ int main()
sheet->write("D7", true);
QXlsx::Worksheet *sheet2 = workbook.addWorksheet();
//Rows and columns are zero indexed.
//The first cell in a worksheet, "A1", is (0, 0).
sheet2->write(0, 0, "First");
sheet2->write(1, 0, "Second");
sheet2->write(2, 0, "Third");
+32
View File
@@ -0,0 +1,32 @@
#include <QtCore>
#include "xlsxworkbook.h"
#include "xlsxworksheet.h"
#include "xlsxformat.h"
#ifdef Q_OS_MAC
# define DATA_PATH "../../../"
#else
# define DATA_PATH "./"
#endif
int main()
{
QXlsx::Workbook workbook;
QXlsx::Worksheet *sheet = workbook.addWorksheet();
QXlsx::Format *format1 = workbook.addFormat();
format1->setFontColor(QColor(Qt::red));
format1->setFontSize(15);
sheet->write("A1", "Hello Qt!", format1);
sheet->write("B3", 12345, format1);
QXlsx::Format *format2 = workbook.addFormat();
format2->setFontBold(true);
format2->setFontUnderline(QXlsx::Format::FontUnderlineDouble);
sheet->write("C5", "=44+33", format2);
sheet->write("D7", true, format2);
workbook.save(DATA_PATH"TestStyle.xlsx");
workbook.save(DATA_PATH"TestStyle.zip");
return 0;
}
+5
View File
@@ -0,0 +1,5 @@
TARGET = style
include(../../src/qtxlsxwriter.pri)
SOURCES += main.cpp