Export the dimension api of worksheet
This commit is contained in:
@@ -116,4 +116,9 @@ QString CellRange::toString() const
|
|||||||
return cell_1 + QLatin1String(":") + cell_2;
|
return cell_1 + QLatin1String(":") + cell_2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CellRange::isValid() const
|
||||||
|
{
|
||||||
|
return left <= right && top <= bottom;
|
||||||
|
}
|
||||||
|
|
||||||
QT_END_NAMESPACE_XLSX
|
QT_END_NAMESPACE_XLSX
|
||||||
|
|||||||
@@ -38,6 +38,11 @@ public:
|
|||||||
~CellRange();
|
~CellRange();
|
||||||
|
|
||||||
QString toString() const;
|
QString toString() const;
|
||||||
|
bool isValid() const;
|
||||||
|
inline void setFirstRow(int row) { top = row; }
|
||||||
|
inline void setLastRow(int row) { bottom = row; }
|
||||||
|
inline void setFirstColumn(int col) { left = col; }
|
||||||
|
inline void setLastColumn(int col) { right = col; }
|
||||||
inline int firstRow() const { return top; }
|
inline int firstRow() const { return top; }
|
||||||
inline int lastRow() const { return bottom; }
|
inline int lastRow() const { return bottom; }
|
||||||
inline int firstColumn() const { return left; }
|
inline int firstColumn() const { return left; }
|
||||||
|
|||||||
@@ -208,6 +208,14 @@ Cell *Document::cellAt(int row, int col) const
|
|||||||
return currentWorksheet()->cellAt(row, col);
|
return currentWorksheet()->cellAt(row, col);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Return the range that contains cell data.
|
||||||
|
*/
|
||||||
|
CellRange Document::dimension() const
|
||||||
|
{
|
||||||
|
return currentWorksheet()->dimension();
|
||||||
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns the value of the document's \a key property.
|
* Returns the value of the document's \a key property.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class Worksheet;
|
|||||||
class Package;
|
class Package;
|
||||||
class Format;
|
class Format;
|
||||||
class Cell;
|
class Cell;
|
||||||
|
class CellRange;
|
||||||
class DataValidation;
|
class DataValidation;
|
||||||
|
|
||||||
class DocumentPrivate;
|
class DocumentPrivate;
|
||||||
@@ -66,6 +67,8 @@ public:
|
|||||||
Cell *cellAt(const QString &cell) const;
|
Cell *cellAt(const QString &cell) const;
|
||||||
Cell *cellAt(int row, int col) const;
|
Cell *cellAt(int row, int col) const;
|
||||||
|
|
||||||
|
CellRange dimension() const;
|
||||||
|
|
||||||
QString documentProperty(const QString &name) const;
|
QString documentProperty(const QString &name) const;
|
||||||
void setDocumentProperty(const QString &name, const QString &property);
|
void setDocumentProperty(const QString &name, const QString &property);
|
||||||
QStringList documentPropertyNames() const;
|
QStringList documentPropertyNames() const;
|
||||||
|
|||||||
+20
-115
@@ -57,10 +57,6 @@ WorksheetPrivate::WorksheetPrivate(Worksheet *p) :
|
|||||||
xls_rowmax = 1048576;
|
xls_rowmax = 1048576;
|
||||||
xls_colmax = 16384;
|
xls_colmax = 16384;
|
||||||
xls_strmax = 32767;
|
xls_strmax = 32767;
|
||||||
dim_rowmin = INT32_MAX;
|
|
||||||
dim_rowmax = INT32_MIN;
|
|
||||||
dim_colmin = INT32_MAX;
|
|
||||||
dim_colmax = INT32_MIN;
|
|
||||||
|
|
||||||
previous_row = 0;
|
previous_row = 0;
|
||||||
|
|
||||||
@@ -94,9 +90,9 @@ void WorksheetPrivate::calculateSpans()
|
|||||||
int span_min = INT32_MAX;
|
int span_min = INT32_MAX;
|
||||||
int span_max = INT32_MIN;
|
int span_max = INT32_MIN;
|
||||||
|
|
||||||
for (int row_num = dim_rowmin; row_num <= dim_rowmax; row_num++) {
|
for (int row_num = dimension.firstRow(); row_num <= dimension.lastRow(); row_num++) {
|
||||||
if (cellTable.contains(row_num)) {
|
if (cellTable.contains(row_num)) {
|
||||||
for (int col_num = dim_colmin; col_num <= dim_colmax; col_num++) {
|
for (int col_num = dimension.firstColumn(); col_num <= dimension.lastColumn(); col_num++) {
|
||||||
if (cellTable[row_num].contains(col_num)) {
|
if (cellTable[row_num].contains(col_num)) {
|
||||||
if (span_max == INT32_MIN) {
|
if (span_max == INT32_MIN) {
|
||||||
span_min = col_num;
|
span_min = col_num;
|
||||||
@@ -111,7 +107,7 @@ void WorksheetPrivate::calculateSpans()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (comments.contains(row_num)) {
|
if (comments.contains(row_num)) {
|
||||||
for (int col_num = dim_colmin; col_num <= dim_colmax; col_num++) {
|
for (int col_num = dimension.firstColumn(); col_num <= dimension.lastColumn(); col_num++) {
|
||||||
if (comments[row_num].contains(col_num)) {
|
if (comments[row_num].contains(col_num)) {
|
||||||
if (span_max == INT32_MIN) {
|
if (span_max == INT32_MIN) {
|
||||||
span_min = col_num;
|
span_min = col_num;
|
||||||
@@ -126,7 +122,7 @@ void WorksheetPrivate::calculateSpans()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((row_num + 1)%16 == 0 || row_num == dim_rowmax) {
|
if ((row_num + 1)%16 == 0 || row_num == dimension.lastRow()) {
|
||||||
int span_index = row_num / 16;
|
int span_index = row_num / 16;
|
||||||
if (span_max != INT32_MIN) {
|
if (span_max != INT32_MIN) {
|
||||||
span_min += 1;
|
span_min += 1;
|
||||||
@@ -141,32 +137,10 @@ void WorksheetPrivate::calculateSpans()
|
|||||||
|
|
||||||
QString WorksheetPrivate::generateDimensionString()
|
QString WorksheetPrivate::generateDimensionString()
|
||||||
{
|
{
|
||||||
if (dim_rowmax == INT32_MIN && dim_colmax == INT32_MIN) {
|
if (!dimension.isValid())
|
||||||
//If the max dimensions are equal to INT32_MIN, then no dimension have been set
|
|
||||||
//and we use the default "A1"
|
|
||||||
return QStringLiteral("A1");
|
return QStringLiteral("A1");
|
||||||
}
|
else
|
||||||
|
return dimension.toString();
|
||||||
if (dim_rowmax == INT32_MIN) {
|
|
||||||
//row dimensions aren't set but the column dimensions are set
|
|
||||||
if (dim_colmin == dim_colmax) {
|
|
||||||
//The dimensions are a single cell and not a range
|
|
||||||
return xl_rowcol_to_cell(0, dim_colmin);
|
|
||||||
} else {
|
|
||||||
const QString cell_1 = xl_rowcol_to_cell(0, dim_colmin);
|
|
||||||
const QString cell_2 = xl_rowcol_to_cell(0, dim_colmax);
|
|
||||||
return cell_1 + QLatin1String(":") + cell_2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dim_rowmin == dim_rowmax && dim_colmin == dim_colmax) {
|
|
||||||
//Single cell
|
|
||||||
return xl_rowcol_to_cell(dim_rowmin, dim_rowmin);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString cell_1 = xl_rowcol_to_cell(dim_rowmin, dim_colmin);
|
|
||||||
QString cell_2 = xl_rowcol_to_cell(dim_rowmax, dim_colmax);
|
|
||||||
return cell_1 + QLatin1String(":") + cell_2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -182,12 +156,12 @@ int WorksheetPrivate::checkDimensions(int row, int col, bool ignore_row, bool ig
|
|||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!ignore_row) {
|
if (!ignore_row) {
|
||||||
if (row < dim_rowmin) dim_rowmin = row;
|
if (row < dimension.firstRow() || dimension.firstRow() == -1) dimension.setFirstRow(row);
|
||||||
if (row > dim_rowmax) dim_rowmax = row;
|
if (row > dimension.lastRow()) dimension.setLastRow(row);
|
||||||
}
|
}
|
||||||
if (!ignore_col) {
|
if (!ignore_col) {
|
||||||
if (col < dim_colmin) dim_colmin = col;
|
if (col < dimension.firstColumn() || dimension.firstColumn() == -1) dimension.setFirstColumn(col);
|
||||||
if (col > dim_colmax) dim_colmax = col;
|
if (col > dimension.lastColumn()) dimension.setLastColumn(col);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@@ -671,11 +645,8 @@ void Worksheet::saveToXmlFile(QIODevice *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
writer.writeStartElement(QStringLiteral("sheetData"));
|
writer.writeStartElement(QStringLiteral("sheetData"));
|
||||||
if (d->dim_rowmax == INT32_MIN) {
|
if (d->dimension.isValid())
|
||||||
//If the max dimensions are equal to INT32_MIN, then there is no data to write
|
|
||||||
} else {
|
|
||||||
d->writeSheetData(writer);
|
d->writeSheetData(writer);
|
||||||
}
|
|
||||||
writer.writeEndElement();//sheetData
|
writer.writeEndElement();//sheetData
|
||||||
|
|
||||||
d->writeMergeCells(writer);
|
d->writeMergeCells(writer);
|
||||||
@@ -690,7 +661,7 @@ void Worksheet::saveToXmlFile(QIODevice *device)
|
|||||||
void WorksheetPrivate::writeSheetData(XmlStreamWriter &writer)
|
void WorksheetPrivate::writeSheetData(XmlStreamWriter &writer)
|
||||||
{
|
{
|
||||||
calculateSpans();
|
calculateSpans();
|
||||||
for (int row_num = dim_rowmin; row_num <= dim_rowmax; row_num++) {
|
for (int row_num = dimension.firstRow(); row_num <= dimension.lastRow(); row_num++) {
|
||||||
if (!(cellTable.contains(row_num) || comments.contains(row_num) || rowsInfo.contains(row_num))) {
|
if (!(cellTable.contains(row_num) || comments.contains(row_num) || rowsInfo.contains(row_num))) {
|
||||||
//Only process rows with cell data / comments / formatting
|
//Only process rows with cell data / comments / formatting
|
||||||
continue;
|
continue;
|
||||||
@@ -722,7 +693,7 @@ void WorksheetPrivate::writeSheetData(XmlStreamWriter &writer)
|
|||||||
writer.writeAttribute(QStringLiteral("hidden"), QStringLiteral("1"));
|
writer.writeAttribute(QStringLiteral("hidden"), QStringLiteral("1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int col_num = dim_colmin; col_num <= dim_colmax; col_num++) {
|
for (int col_num = dimension.firstColumn(); col_num <= dimension.lastColumn(); col_num++) {
|
||||||
if (cellTable[row_num].contains(col_num)) {
|
if (cellTable[row_num].contains(col_num)) {
|
||||||
writeCellData(writer, row_num, col_num, cellTable[row_num][col_num]);
|
writeCellData(writer, row_num, col_num, cellTable[row_num][col_num]);
|
||||||
}
|
}
|
||||||
@@ -934,7 +905,7 @@ void WorksheetPrivate::writeDrawings(XmlStreamWriter &writer)
|
|||||||
bool Worksheet::setRow(int row, double height, Format *format, bool hidden)
|
bool Worksheet::setRow(int row, double height, Format *format, bool hidden)
|
||||||
{
|
{
|
||||||
Q_D(Worksheet);
|
Q_D(Worksheet);
|
||||||
int min_col = d->dim_colmax == INT32_MIN ? 0 : d->dim_colmin;
|
int min_col = d->dimension.firstColumn() < 0 ? 0 : d->dimension.firstColumn();
|
||||||
|
|
||||||
if (d->checkDimensions(row, min_col))
|
if (d->checkDimensions(row, min_col))
|
||||||
return false;
|
return false;
|
||||||
@@ -976,65 +947,12 @@ bool Worksheet::setColumn(int colFirst, int colLast, double width, Format *forma
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Returns the first row in the sheet that contains a used cell.
|
Return the range that contains cell data.
|
||||||
*/
|
*/
|
||||||
int Worksheet::firstRow() const
|
CellRange Worksheet::dimension() const
|
||||||
{
|
{
|
||||||
Q_D(const Worksheet);
|
Q_D(const Worksheet);
|
||||||
|
return d->dimension;
|
||||||
if (d->dim_rowmax == INT32_MIN) {
|
|
||||||
//Row dimenstion isn't set.
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return d->dim_rowmin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Returns the zero-based index of the row after the last row in
|
|
||||||
* the sheet that contains a used cell.
|
|
||||||
*/
|
|
||||||
int Worksheet::lastRow() const
|
|
||||||
{
|
|
||||||
Q_D(const Worksheet);
|
|
||||||
|
|
||||||
if (d->dim_rowmax == INT32_MIN) {
|
|
||||||
//Row dimenstion isn't set.
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return d->dim_rowmax + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Returns the first column in the sheet that contains a used cell.
|
|
||||||
*/
|
|
||||||
int Worksheet::firstColumn() const
|
|
||||||
{
|
|
||||||
Q_D(const Worksheet);
|
|
||||||
|
|
||||||
if (d->dim_colmax == INT32_MIN) {
|
|
||||||
//Col dimenstion isn't set.
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return d->dim_colmin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Returns the zero-based index of the column after the last column
|
|
||||||
* in the sheet that contains a used cell.
|
|
||||||
*/
|
|
||||||
int Worksheet::lastColumn() const
|
|
||||||
{
|
|
||||||
Q_D(const Worksheet);
|
|
||||||
|
|
||||||
if (d->dim_colmax == INT32_MIN) {
|
|
||||||
//Col dimenstion isn't set.
|
|
||||||
return 0;
|
|
||||||
} else {
|
|
||||||
return d->dim_colmax + 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Drawing *Worksheet::drawing() const
|
Drawing *Worksheet::drawing() const
|
||||||
@@ -1571,21 +1489,8 @@ bool Worksheet::loadFromXmlFile(QIODevice *device)
|
|||||||
if (reader.tokenType() == QXmlStreamReader::StartElement) {
|
if (reader.tokenType() == QXmlStreamReader::StartElement) {
|
||||||
if (reader.name() == QLatin1String("dimension")) {
|
if (reader.name() == QLatin1String("dimension")) {
|
||||||
QXmlStreamAttributes attributes = reader.attributes();
|
QXmlStreamAttributes attributes = reader.attributes();
|
||||||
QStringList range = attributes.value(QLatin1String("ref")).toString().split(QLatin1Char(':'));
|
QString range = attributes.value(QLatin1String("ref")).toString();
|
||||||
if (range.size() == 2) {
|
d->dimension = CellRange(range);
|
||||||
QPoint start = xl_cell_to_rowcol(range[0]);
|
|
||||||
QPoint end = xl_cell_to_rowcol(range[1]);
|
|
||||||
d->dim_rowmin = start.x();
|
|
||||||
d->dim_colmin = start.y();
|
|
||||||
d->dim_rowmax = end.x();
|
|
||||||
d->dim_colmax = end.y();
|
|
||||||
} else {
|
|
||||||
QPoint p = xl_cell_to_rowcol(range[0]);
|
|
||||||
d->dim_rowmin = p.x();
|
|
||||||
d->dim_colmin = p.y();
|
|
||||||
d->dim_rowmax = p.x();
|
|
||||||
d->dim_colmax = p.y();
|
|
||||||
}
|
|
||||||
} else if (reader.name() == QLatin1String("sheetViews")) {
|
} else if (reader.name() == QLatin1String("sheetViews")) {
|
||||||
|
|
||||||
} else if (reader.name() == QLatin1String("sheetFormatPr")) {
|
} else if (reader.name() == QLatin1String("sheetFormatPr")) {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ class Workbook;
|
|||||||
class Format;
|
class Format;
|
||||||
class Drawing;
|
class Drawing;
|
||||||
class DataValidation;
|
class DataValidation;
|
||||||
|
class CellRange;
|
||||||
struct XlsxImageData;
|
struct XlsxImageData;
|
||||||
|
|
||||||
class WorksheetPrivate;
|
class WorksheetPrivate;
|
||||||
@@ -79,11 +80,7 @@ public:
|
|||||||
|
|
||||||
bool setRow(int row, double height, Format* format=0, bool hidden=false);
|
bool setRow(int row, double height, Format* format=0, bool hidden=false);
|
||||||
bool setColumn(int colFirst, int colLast, double width, Format* format=0, bool hidden=false);
|
bool setColumn(int colFirst, int colLast, double width, Format* format=0, bool hidden=false);
|
||||||
|
CellRange dimension() const;
|
||||||
int firstRow() const;
|
|
||||||
int lastRow() const;
|
|
||||||
int firstColumn() const;
|
|
||||||
int lastColumn() const;
|
|
||||||
|
|
||||||
void setRightToLeft(bool enable);
|
void setRightToLeft(bool enable);
|
||||||
void setZeroValuesHidden(bool enable);
|
void setZeroValuesHidden(bool enable);
|
||||||
|
|||||||
@@ -195,10 +195,7 @@ public:
|
|||||||
int xls_rowmax;
|
int xls_rowmax;
|
||||||
int xls_colmax;
|
int xls_colmax;
|
||||||
int xls_strmax;
|
int xls_strmax;
|
||||||
int dim_rowmin;
|
CellRange dimension;
|
||||||
int dim_rowmax;
|
|
||||||
int dim_colmin;
|
|
||||||
int dim_colmax;
|
|
||||||
int previous_row;
|
int previous_row;
|
||||||
|
|
||||||
QMap<int, QString> row_spans;
|
QMap<int, QString> row_spans;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "xlsxworksheet.h"
|
#include "xlsxworksheet.h"
|
||||||
#include "xlsxcell.h"
|
#include "xlsxcell.h"
|
||||||
|
#include "xlsxcellrange.h"
|
||||||
#include "xlsxdatavalidation.h"
|
#include "xlsxdatavalidation.h"
|
||||||
#include "private/xlsxworksheet_p.h"
|
#include "private/xlsxworksheet_p.h"
|
||||||
#include "private/xlsxxmlreader_p.h"
|
#include "private/xlsxxmlreader_p.h"
|
||||||
@@ -17,11 +18,7 @@ public:
|
|||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void testEmptySheet();
|
void testEmptySheet();
|
||||||
|
void testDimension();
|
||||||
void testFirstRow();
|
|
||||||
void testLastRow();
|
|
||||||
void testFirstColumn();
|
|
||||||
void testLastColumn();
|
|
||||||
|
|
||||||
void testWriteCells();
|
void testWriteCells();
|
||||||
void testWriteHyperlinks();
|
void testWriteHyperlinks();
|
||||||
@@ -49,76 +46,23 @@ void WorksheetTest::testEmptySheet()
|
|||||||
QVERIFY2(!xmldata.contains("<mergeCell"), "");
|
QVERIFY2(!xmldata.contains("<mergeCell"), "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorksheetTest::testFirstRow()
|
void WorksheetTest::testDimension()
|
||||||
{
|
{
|
||||||
QXlsx::Worksheet sheet("", 1, 0);
|
QXlsx::Worksheet sheet("", 1, 0);
|
||||||
QCOMPARE(sheet.firstRow(), 0); //Default
|
QCOMPARE(sheet.dimension(), QXlsx::CellRange()); //Default
|
||||||
|
|
||||||
sheet.write(10000, 10000, "For test");
|
|
||||||
QCOMPARE(sheet.firstRow(), 10000);
|
|
||||||
|
|
||||||
sheet.write("C3", "Test");
|
sheet.write("C3", "Test");
|
||||||
QCOMPARE(sheet.firstRow(), 2); //Single Cell
|
qDebug()<<sheet.dimension().toString();
|
||||||
|
QCOMPARE(sheet.dimension(), QXlsx::CellRange(2, 2, 2, 2)); //Single Cell
|
||||||
|
|
||||||
sheet.write("B2", "Second");
|
sheet.write("B2", "Second");
|
||||||
QCOMPARE(sheet.firstRow(), 1);
|
QCOMPARE(sheet.dimension(), QXlsx::CellRange(1, 1, 2, 2));
|
||||||
|
|
||||||
sheet.write("D4", "Test");
|
sheet.write("D4", "Test");
|
||||||
QCOMPARE(sheet.firstRow(), 1);
|
QCOMPARE(sheet.dimension(), QXlsx::CellRange("B2:D4"));
|
||||||
}
|
|
||||||
|
|
||||||
void WorksheetTest::testLastRow()
|
|
||||||
{
|
|
||||||
QXlsx::Worksheet sheet("", 1, 0);
|
|
||||||
QCOMPARE(sheet.lastRow(), 0); //Default
|
|
||||||
|
|
||||||
sheet.write("C3", "Test");
|
|
||||||
QCOMPARE(sheet.lastRow(), 3); //Single Cell
|
|
||||||
|
|
||||||
sheet.write("B2", "Second");
|
|
||||||
QCOMPARE(sheet.lastRow(), 3);
|
|
||||||
|
|
||||||
sheet.write("D4", "Test");
|
|
||||||
QCOMPARE(sheet.lastRow(), 4);
|
|
||||||
|
|
||||||
sheet.write(10000, 10000, "For test");
|
sheet.write(10000, 10000, "For test");
|
||||||
QCOMPARE(sheet.lastRow(), 10001);
|
QCOMPARE(sheet.dimension(), QXlsx::CellRange(1, 1, 10000, 10000));
|
||||||
}
|
|
||||||
|
|
||||||
void WorksheetTest::testFirstColumn()
|
|
||||||
{
|
|
||||||
QXlsx::Worksheet sheet("", 1, 0);
|
|
||||||
QCOMPARE(sheet.firstColumn(), 0); //Default
|
|
||||||
|
|
||||||
sheet.write(10000, 10000, "For test");
|
|
||||||
QCOMPARE(sheet.firstColumn(), 10000);
|
|
||||||
|
|
||||||
sheet.write("C3", "Test");
|
|
||||||
QCOMPARE(sheet.firstColumn(), 2); //Single Cell
|
|
||||||
|
|
||||||
sheet.write("B2", "Second");
|
|
||||||
QCOMPARE(sheet.firstColumn(), 1);
|
|
||||||
|
|
||||||
sheet.write("D4", "Test");
|
|
||||||
QCOMPARE(sheet.firstColumn(), 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorksheetTest::testLastColumn()
|
|
||||||
{
|
|
||||||
QXlsx::Worksheet sheet("", 1, 0);
|
|
||||||
QCOMPARE(sheet.lastColumn(), 0); //Default
|
|
||||||
|
|
||||||
sheet.write("C3", "Test");
|
|
||||||
QCOMPARE(sheet.lastColumn(), 3); //Single Cell
|
|
||||||
|
|
||||||
sheet.write("B2", "Second");
|
|
||||||
QCOMPARE(sheet.lastColumn(), 3);
|
|
||||||
|
|
||||||
sheet.write("D4", "Test");
|
|
||||||
QCOMPARE(sheet.lastColumn(), 4);
|
|
||||||
|
|
||||||
sheet.write(10000, 10000, "For test");
|
|
||||||
QCOMPARE(sheet.lastColumn(), 10001);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorksheetTest::testWriteCells()
|
void WorksheetTest::testWriteCells()
|
||||||
|
|||||||
Reference in New Issue
Block a user