mirror of
https://github.com/QtExcel/QXlsx.git
synced 2025-01-30 05:02:52 +08:00
test v3
This commit is contained in:
parent
673e025ff7
commit
a0907fce31
@ -37,14 +37,15 @@ int readMSExcel201x();
|
||||
|
||||
int readStyle()
|
||||
{
|
||||
readGoogleSpreadsheet();
|
||||
int ret = readGoogleSpreadsheet();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int readGoogleSpreadsheet()
|
||||
{
|
||||
Document xlsx("google-spreadsheet.xlsx"); // google docs
|
||||
// Document xlsx("date-time.xlsx"); // ms office online
|
||||
|
||||
|
||||
if (!xlsx.isLoadPackage())
|
||||
{
|
||||
@ -56,11 +57,11 @@ int readGoogleSpreadsheet()
|
||||
{
|
||||
if (Cell* cell = xlsx.cellAt(row, 1))
|
||||
{
|
||||
if (cell == NULL)
|
||||
if ( cell == NULL )
|
||||
continue;
|
||||
QVariant var = cell->readValue();
|
||||
qint32 styleNo = cell->styleNumber();
|
||||
if (styleNo >= 0)
|
||||
if ( styleNo >= 0 )
|
||||
{
|
||||
qDebug() << row << " " << var << " , style:" << styleNo;
|
||||
}
|
||||
@ -71,7 +72,7 @@ int readGoogleSpreadsheet()
|
||||
}
|
||||
}
|
||||
|
||||
/* debug output
|
||||
/* Deug output
|
||||
1 QVariant(double, 1) , style: 1
|
||||
2 QVariant(QString, "2") , style: 2
|
||||
3 QVariant(double, 3) , style: 3
|
||||
@ -82,13 +83,12 @@ int readGoogleSpreadsheet()
|
||||
8 QVariant(double, 8) , style: 8
|
||||
9 QVariant(double, 9) , style: 9
|
||||
10 QVariant(QString, "1900. 1. 9") , style: 10
|
||||
11 QVariant(QDateTime, QDateTime(1900-01-11 00:00:00.000 KST Qt::TimeSpec(LocalTime))) , style: 11
|
||||
11 QVariant(QTime, QTime("00:00:00.000")) , style: 11
|
||||
12 QVariant(QString, "1900. 1. 11 AM 12:00:00") , style: 12
|
||||
13 QVariant(QDateTime, QDateTime(1900-01-13 00:00:00.000 KST Qt::TimeSpec(LocalTime))) , style: 13
|
||||
*/
|
||||
|
||||
/*
|
||||
testing fo read google spreadsheet file (made by google docs)
|
||||
/* Testing fo read google spreadsheet file (made by google docs)
|
||||
https://github.com/j2doll/QXlsx/blob/master/image/LibreOffice-Google-XLSX.png
|
||||
|
||||
1 QVariant(double, 1) OK:it's auto style (1)
|
||||
@ -118,6 +118,8 @@ int readLibreOffice()
|
||||
|
||||
int readMSExcel201x()
|
||||
{
|
||||
// Document xlsx("date-time.xlsx"); // ms office online
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -124,35 +124,40 @@ QVariant Cell::readValue() const
|
||||
{
|
||||
Q_D(const Cell);
|
||||
|
||||
QVariant ret;
|
||||
QVariant ret; // return value
|
||||
ret = d->value;
|
||||
|
||||
if (isDateTime())
|
||||
{
|
||||
QDateTime dt = dateTime();
|
||||
ret = dt;
|
||||
return ret;
|
||||
|
||||
/*
|
||||
double val = d->value.toDouble();
|
||||
if (val < 1)
|
||||
qint32 styleNo = d->styleNumber;
|
||||
|
||||
if (styleNo == 10)
|
||||
{
|
||||
ret = dt.time(); // it's time type
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
double dFmod = fmod(val, double(1.0));
|
||||
double dRValue = 1.0 / (1000 * 60 * 60 * 24);
|
||||
if ( dFmod < dRValue )
|
||||
if (styleNo == 11) // only time
|
||||
{
|
||||
ret = dt.date(); // it's date type
|
||||
QTime timeValue = dt.time();
|
||||
ret = timeValue;
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = dt;
|
||||
return ret;
|
||||
*/
|
||||
}
|
||||
if (styleNo == 12)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
if (styleNo == 13)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (hasFormula())
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user