Skip to content

Commit

Permalink
change processing of datatype
Browse files Browse the repository at this point in the history
  • Loading branch information
j2doll committed Aug 29, 2019
1 parent 0a26c17 commit ce5793c
Show file tree
Hide file tree
Showing 54 changed files with 609 additions and 588 deletions.
5 changes: 1 addition & 4 deletions Copycat/Copycat.pro
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#
# Copycat.pro
#
# QXlsx, MIT License, https://github.com/QtExcel/QXlsx
#
# QXlsx https://github.com/QtExcel/QXlsx

TARGET = Copycat
TEMPLATE = app
Expand Down
42 changes: 3 additions & 39 deletions Copycat/XlsxTab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ bool XlsxTab::setSheet()
CellLocation cl = clList.at(ic);

////////////////////////////////////////////////////////////////////
// First cell of tableWidget is 0.
// First cell index of tableWidget is 0.
// But first cell of Qxlsx document is 1.
int row = cl.row - 1;
int col = cl.col - 1;
Expand All @@ -117,45 +117,9 @@ bool XlsxTab::setSheet()
QString str;
Cell::CellType cType = cl.cell->cellType();

// [dev54]
if ( cType == Cell::DateType )
{
QString strValue;
QString strDate;
QString strTime;
bool isSetTime = false;
// qDebug() << "(r,c) = " << cl.row << cl.col << var.toString() ;

QDateTime datetimeValue = var.toDateTime();

QTime timeValue = datetimeValue.time();
if ( timeValue.isValid() )
{
strTime = timeValue.toString();

strValue.append( strTime );

isSetTime = true;
}

QDate dateValue = datetimeValue.date();
if ( ! dateValue.isNull() )
{
strDate = dateValue.toString();

if (isSetTime)
strValue.append( " " );

strValue.append( strDate );
}


str = strValue;

}
else
{
str = var.toString();
}
str = var.toString();

////////////////////////////////////////////////////////////////////
// set text
Expand Down
6 changes: 4 additions & 2 deletions QXlsx/QXlsx.pri
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ $${QXLSX_HEADERPATH}xlsxworksheet.h \
$${QXLSX_HEADERPATH}xlsxworksheet_p.h \
$${QXLSX_HEADERPATH}xlsxzipreader_p.h \
$${QXLSX_HEADERPATH}xlsxzipwriter_p.h \
$${QXLSX_HEADERPATH}xlsxcelllocation.h
$${QXLSX_HEADERPATH}xlsxcelllocation.h \
$${QXLSX_HEADERPATH}xlsxdatetype.h

SOURCES += \
$${QXLSX_SOURCEPATH}xlsxabstractooxmlfile.cpp \
Expand Down Expand Up @@ -127,7 +128,8 @@ $${QXLSX_SOURCEPATH}xlsxworkbook.cpp \
$${QXLSX_SOURCEPATH}xlsxworksheet.cpp \
$${QXLSX_SOURCEPATH}xlsxzipreader.cpp \
$${QXLSX_SOURCEPATH}xlsxzipwriter.cpp \
$${QXLSX_SOURCEPATH}xlsxcelllocation.cpp
$${QXLSX_SOURCEPATH}xlsxcelllocation.cpp \
$${QXLSX_SOURCEPATH}xlsxdatetype.cpp


######################################################################
Expand Down
3 changes: 0 additions & 3 deletions QXlsx/header/xlsxabstractooxmlfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
#ifndef QXLSX_XLSXABSTRACTOOXMLFILE_H
#define QXLSX_XLSXABSTRACTOOXMLFILE_H

#include <QIODevice>
#include <QByteArray>

#include "xlsxglobal.h"

QT_BEGIN_NAMESPACE_XLSX
Expand Down
8 changes: 4 additions & 4 deletions QXlsx/header/xlsxabstractooxmlfile_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
#ifndef XLSXOOXMLFILE_P_H
#define XLSXOOXMLFILE_P_H

#include "xlsxglobal.h"

#include "xlsxabstractooxmlfile.h"
#include "xlsxrelationships_p.h"

#include <QString>

QT_BEGIN_NAMESPACE_XLSX

class AbstractOOXmlFilePrivate
{
Q_DECLARE_PUBLIC(AbstractOOXmlFile)

public:
AbstractOOXmlFilePrivate(AbstractOOXmlFile *q, AbstractOOXmlFile::CreateFlag flag);
AbstractOOXmlFilePrivate(AbstractOOXmlFile* q, AbstractOOXmlFile::CreateFlag flag);
virtual ~AbstractOOXmlFilePrivate();

public:
QString filePathInPackage;//such as "xl/worksheets/sheet1.xml"
QString filePathInPackage; //such as "xl/worksheets/sheet1.xml"

Relationships *relationships;
AbstractOOXmlFile::CreateFlag flag;
Expand Down
7 changes: 1 addition & 6 deletions QXlsx/header/xlsxabstractsheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@
#ifndef XLSXABSTRACTSHEET_H
#define XLSXABSTRACTSHEET_H

#include <QtGlobal>
#include <QObject>
#include <QString>
#include <QStringList>
#include <QSharedPointer>

#include "xlsxglobal.h"
#include "xlsxabstractooxmlfile.h"

QT_BEGIN_NAMESPACE_XLSX
Expand Down
39 changes: 4 additions & 35 deletions QXlsx/header/xlsxabstractsheet_p.h
Original file line number Diff line number Diff line change
@@ -1,46 +1,14 @@
/****************************************************************************
** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me>
** All right reserved.
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be
** included in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**
****************************************************************************/
//

#ifndef XLSXABSTRACTSHEET_P_H
#define XLSXABSTRACTSHEET_P_H

//
// W A R N I N G
// -------------
//
// This file is not part of the Qt Xlsx API. It exists for the convenience
// of the Qt Xlsx. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
//

#include <QtGlobal>
#include <QString>
#include <QSharedPointer>

#include "xlsxglobal.h"

#include "xlsxabstractsheet.h"
#include "xlsxabstractooxmlfile_p.h"

Expand All @@ -63,4 +31,5 @@ class AbstractSheetPrivate : public AbstractOOXmlFilePrivate
};

QT_END_NAMESPACE_XLSX

#endif // XLSXABSTRACTSHEET_P_H
8 changes: 7 additions & 1 deletion QXlsx/header/xlsxcell.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
#include <cstdio>

#include <QtGlobal>
#include <QObject>
#include <QString>
#include <QVariant>
#include <QDate>
#include <QDateTime>
#include <QTime>

#include "xlsxglobal.h"
#include "xlsxformat.h"
Expand Down Expand Up @@ -62,7 +67,8 @@ class Cell
CellFormula formula() const;

bool isDateTime() const;
QDateTime dateTime() const;
// QDateTime dateTime() const;
QVariant dateTime() const;

bool isRichString() const;

Expand Down
1 change: 1 addition & 0 deletions QXlsx/header/xlsxcellformula.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#define QXLSX_XLSXCELLFORMULA_H

#include "xlsxglobal.h"

#include <QExplicitlySharedDataPointer>

class QXmlStreamWriter;
Expand Down
37 changes: 2 additions & 35 deletions QXlsx/header/xlsxcellformula_p.h
Original file line number Diff line number Diff line change
@@ -1,41 +1,8 @@
/****************************************************************************
** Copyright (c) 2013-2014 Debao Zhang <hello@debao.me>
** All right reserved.
**
** Permission is hereby granted, free of charge, to any person obtaining
** a copy of this software and associated documentation files (the
** "Software"), to deal in the Software without restriction, including
** without limitation the rights to use, copy, modify, merge, publish,
** distribute, sublicense, and/or sell copies of the Software, and to
** permit persons to whom the Software is furnished to do so, subject to
** the following conditions:
**
** The above copyright notice and this permission notice shall be
** included in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
**
****************************************************************************/
//

#ifndef XLSXCELLFORMULA_P_H
#define XLSXCELLFORMULA_P_H

//
// W A R N I N G
// -------------
//
// This file is not part of the Qt Xlsx API. It exists for the convenience
// of the Qt Xlsx. This header file may change from
// version to version without notice, or even be removed.
//
// We mean it.
//

#include "xlsxglobal.h"
#include "xlsxcellformula.h"
#include "xlsxcellrange.h"
Expand Down
11 changes: 1 addition & 10 deletions QXlsx/header/xlsxcelllocation.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
//--------------------------------------------------------------------
//
// QXlsx
// MIT License
// https://github.com/j2doll/QXlsx
//
// QtXlsx
// https://github.com/dbzhang800/QtXlsxWriter
// http://qtxlsx.debao.me/
// MIT License
//

#ifndef CELL_LOCATION_H
#define CELL_LOCATION_H

Expand Down
1 change: 1 addition & 0 deletions QXlsx/header/xlsxcellrange.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// xlsxcellrange.h

#ifndef QXLSX_XLSXCELLRANGE_H
#define QXLSX_XLSXCELLRANGE_H

Expand Down
9 changes: 5 additions & 4 deletions QXlsx/header/xlsxcolor_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,19 @@
// We mean it.
//

#include "xlsxglobal.h"
#include <QVariant>
#include <QColor>

#include "xlsxglobal.h"

class QXmlStreamWriter;
class QXmlStreamReader;

namespace QXlsx {
QT_BEGIN_NAMESPACE_XLSX

class Styles;

class XlsxColor
class XlsxColor
{
public:
explicit XlsxColor(const QColor &color = QColor());
Expand Down Expand Up @@ -85,7 +86,7 @@ class XlsxColor
QDebug operator<<(QDebug dbg, const XlsxColor &c);
#endif

} // namespace QXlsx
QT_END_NAMESPACE_XLSX

Q_DECLARE_METATYPE(QXlsx::XlsxColor)

Expand Down
48 changes: 48 additions & 0 deletions QXlsx/header/xlsxdatetype.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// xlsxdatetype.h

#ifndef QXLSX_XLSXDATETYPE_H
#define QXLSX_XLSXDATETYPE_H

#include <QtGlobal>
#include <QObject>
#include <QString>
#include <QStringList>
#include <QDateTime>
#include <QDate>
#include <QTime>

#include "xlsxglobal.h"

QT_BEGIN_NAMESPACE_XLSX

class DateType
{
public:
DateType();
/*
DateType(bool is1904 = false);
DateType(double d, bool is1904 = false);
DateType(QDateTime qdt, bool is1904 = false);
DateType(QDate qd, bool is1904 = false);
DateType(QTime qt, bool is1904 = false);
public:
enum currentDateType { DateAndTimeType, OnlyDateType, OnlyTimeType };
public:
currentDateType getType();
bool getValue(QDateTime* pQdt);
bool getValue(QDate* pQd);
bool getValue(QTime* pQt);
bool getValue(double* pD);
protected:
protected:
bool isSet;
double dValue;
bool is1904Type;
currentDateType dType;
*/
};

QT_END_NAMESPACE_XLSX
#endif
5 changes: 3 additions & 2 deletions QXlsx/header/xlsxdocpropsapp_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@

class QIODevice;

namespace QXlsx {
QT_BEGIN_NAMESPACE_XLSX

class DocPropsApp : public AbstractOOXmlFile
{
Expand All @@ -68,5 +68,6 @@ class DocPropsApp : public AbstractOOXmlFile
QMap<QString, QString> m_properties;
};

}
QT_END_NAMESPACE_XLSX

#endif // XLSXDOCPROPSAPP_H
Loading

0 comments on commit ce5793c

Please sign in to comment.