1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-30 05:02:52 +08:00

reading chart axis name

This commit is contained in:
Jay Two 2019-02-26 15:24:03 +09:00
parent ab309ed7de
commit ab371541cd
4 changed files with 313 additions and 239 deletions

View File

@ -70,10 +70,12 @@ public:
public: public:
bool loadXmlChart(QXmlStreamReader &reader); bool loadXmlChart(QXmlStreamReader &reader);
bool loadXmlPlotArea(QXmlStreamReader &reader); bool loadXmlPlotArea(QXmlStreamReader &reader);
protected:
bool loadXmlPlotAreaElement(QXmlStreamReader &reader);
public:
bool loadXmlXxxChart(QXmlStreamReader &reader); bool loadXmlXxxChart(QXmlStreamReader &reader);
bool loadXmlSer(QXmlStreamReader &reader); bool loadXmlSer(QXmlStreamReader &reader);
QString loadXmlNumRef(QXmlStreamReader &reader); QString loadXmlNumRef(QXmlStreamReader &reader);
bool loadXmlAxis(QXmlStreamReader &reader);
bool loadXmlChartTitle(QXmlStreamReader &reader); bool loadXmlChartTitle(QXmlStreamReader &reader);
protected: protected:
bool loadXmlChartTitleTx(QXmlStreamReader &reader); bool loadXmlChartTitleTx(QXmlStreamReader &reader);
@ -86,11 +88,14 @@ protected:
bool loadXmlAxisSerAx(QXmlStreamReader &reader); bool loadXmlAxisSerAx(QXmlStreamReader &reader);
bool loadXmlAxisValAx(QXmlStreamReader &reader); bool loadXmlAxisValAx(QXmlStreamReader &reader);
bool loadXmlAxisEG_AxShared(QXmlStreamReader &reader, XlsxAxis* axis); bool loadXmlAxisEG_AxShared(QXmlStreamReader &reader, XlsxAxis* axis);
bool loadXmlAxisEG_AxShared_Scaling(QXmlStreamReader &reader, XlsxAxis* axis);
bool loadXmlAxisEG_AxShared_Title(QXmlStreamReader &reader, XlsxAxis* axis); bool loadXmlAxisEG_AxShared_Title(QXmlStreamReader &reader, XlsxAxis* axis);
bool loadXmlAxisEG_AxShared_Title_Overlay(QXmlStreamReader &reader, XlsxAxis* axis);
bool loadXmlAxisEG_AxShared_Title_Tx(QXmlStreamReader &reader, XlsxAxis* axis); bool loadXmlAxisEG_AxShared_Title_Tx(QXmlStreamReader &reader, XlsxAxis* axis);
bool loadXmlAxisEG_AxShared_Title_Tx_Rich(QXmlStreamReader &reader, XlsxAxis* axis); bool loadXmlAxisEG_AxShared_Title_Tx_Rich(QXmlStreamReader &reader, XlsxAxis* axis);
bool loadXmlAxisEG_AxShared_Title_Tx_Rich_P(QXmlStreamReader &reader, XlsxAxis* axis); bool loadXmlAxisEG_AxShared_Title_Tx_Rich_P(QXmlStreamReader &reader, XlsxAxis* axis);
bool loadXmlAxisEG_AxShared_Title_Tx_Rich_P_T(QXmlStreamReader &reader, XlsxAxis* axis); bool loadXmlAxisEG_AxShared_Title_Tx_Rich_P_pPr(QXmlStreamReader &reader, XlsxAxis* axis);
bool loadXmlAxisEG_AxShared_Title_Tx_Rich_P_R(QXmlStreamReader &reader, XlsxAxis* axis);
public: public:
void saveXmlChart(QXmlStreamWriter &writer) const; void saveXmlChart(QXmlStreamWriter &writer) const;

View File

@ -308,97 +308,115 @@ bool ChartPrivate::loadXmlChart(QXmlStreamReader &reader)
} }
// TO DEBUG: loop is not work, when i looping second element. // TO DEBUG: loop is not work, when i looping second element.
/*
dchrt_CT_PlotArea =
element layout { dchrt_CT_Layout }?,
(element areaChart { dchrt_CT_AreaChart }
| element area3DChart { dchrt_ CT_Area3DChart }
| element lineChart { dchrt_CT_LineChart }
| element line3DChart { dchrt_CT_Line3DChart }
| element stockChart { dchrt_CT_StockChart }
| element radarChart { dchrt_CT_RadarChart }
| element scatterChart { dchrt_CT_ScatterChart }
| element pieChart { dchrt_CT_PieChart }
| element pie3DChart { dchrt_CT_Pie3DChart }
| element doughnutChart { dchrt_CT_DoughnutChart }
| element barChart { dchrt_CT_BarChart }
| element bar3DChart { dchrt_CT_Bar3DChart }
| element ofPieChart { dchrt_CT_OfPieChart }
| element surfaceChart { dchrt_CT_SurfaceChart }
| element surface3DChart { dchrt_CT_Surface3DChart }
| element bubbleChart { dchrt_CT_BubbleChart })+,
(element valAx { dchrt_CT_ValAx }
| element catAx { dchrt_CT_CatAx }
| element dateAx { dchrt_CT_DateAx }
| element serAx { dchrt_CT_SerAx })*,
element dTable { dchrt_CT_DTable }?,
element spPr { a_CT_ShapeProperties }?,
element extLst { dchrt_CT_ExtensionList }?
*/
bool ChartPrivate::loadXmlPlotArea(QXmlStreamReader &reader) bool ChartPrivate::loadXmlPlotArea(QXmlStreamReader &reader)
{ {
Q_ASSERT(reader.name() == QLatin1String("plotArea")); Q_ASSERT(reader.name() == QLatin1String("plotArea"));
/*
dchrt_CT_PlotArea =
element layout { dchrt_CT_Layout }?,
(element areaChart { dchrt_CT_AreaChart }
| element area3DChart { dchrt_ CT_Area3DChart }
| element lineChart { dchrt_CT_LineChart }
| element line3DChart { dchrt_CT_Line3DChart }
| element stockChart { dchrt_CT_StockChart }
| element radarChart { dchrt_CT_RadarChart }
| element scatterChart { dchrt_CT_ScatterChart }
| element pieChart { dchrt_CT_PieChart }
| element pie3DChart { dchrt_CT_Pie3DChart }
| element doughnutChart { dchrt_CT_DoughnutChart }
| element barChart { dchrt_CT_BarChart }
| element bar3DChart { dchrt_CT_Bar3DChart }
| element ofPieChart { dchrt_CT_OfPieChart }
| element surfaceChart { dchrt_CT_SurfaceChart }
| element surface3DChart { dchrt_CT_Surface3DChart }
| element bubbleChart { dchrt_CT_BubbleChart })+,
(element valAx { dchrt_CT_ValAx }
| element catAx { dchrt_CT_CatAx }
| element dateAx { dchrt_CT_DateAx }
| element serAx { dchrt_CT_SerAx })*,
element dTable { dchrt_CT_DTable }?,
element spPr { a_CT_ShapeProperties }?,
element extLst { dchrt_CT_ExtensionList }?
*/
// TO DEBUG: // TO DEBUG:
reader.readNext();
while (!reader.atEnd()) while (!reader.atEnd())
{ {
if (reader.isStartElement())
QXmlStreamReader::TokenType retType = reader.readNext();
qDebug() << "[debug] " << reader.name() << retType;
if (reader.name() == QLatin1String("layout"))
{
//!ToDo
// layout
}
else if (reader.name().endsWith(QLatin1String("Chart")))
{
// for pieChart, barChart, ... (choose one)
loadXmlXxxChart(reader);
}
else if (reader.name() == QLatin1String("catAx")) // choose one : catAx, dateAx, serAx, valAx
{
loadXmlAxisCatAx(reader);
}
else if (reader.name() == QLatin1String("dateAx")) // choose one : catAx, dateAx, serAx, valAx
{
loadXmlAxisDateAx(reader);
}
else if (reader.name() == QLatin1String("serAx")) // choose one : catAx, dateAx, serAx, valAx
{
loadXmlAxisSerAx(reader);
}
else if (reader.name() == QLatin1String("valAx")) // choose one : catAx, dateAx, serAx, valAx
{
loadXmlAxisValAx(reader);
}
else if (reader.name() == QLatin1String("dTable"))
{
//!ToDo
// dTable "CT_DTable"
}
else if (reader.name() == QLatin1String("spPr"))
{
//!ToDo
// spPr "a:CT_ShapeProperties"
}
else if (reader.name() == QLatin1String("extLst"))
{
//!ToDo
// extLst "CT_ExtensionList"
}
if ( reader.tokenType() == QXmlStreamReader::EndElement &&
reader.name() == QLatin1String("plotArea") )
{ {
break; if (!loadXmlPlotAreaElement(reader))
{
qDebug() << "[debug] failed to load plotarea element.";
return false;
}
reader.readNext();
} }
else
{
reader.readNext();
}
}
return true;
}
bool ChartPrivate::loadXmlPlotAreaElement(QXmlStreamReader &reader)
{
if (reader.name() == QLatin1String("layout"))
{
//!ToDo
// layout
reader.skipCurrentElement();
}
else if (reader.name().endsWith(QLatin1String("Chart")))
{
// for pieChart, barChart, ... (choose one)
if ( ! loadXmlXxxChart(reader) )
{
qDebug() << "[debug] failed to load chart";
return false;
}
}
else if (reader.name() == QLatin1String("catAx")) // choose one : catAx, dateAx, serAx, valAx
{
loadXmlAxisCatAx(reader);
}
else if (reader.name() == QLatin1String("dateAx")) // choose one : catAx, dateAx, serAx, valAx
{
loadXmlAxisDateAx(reader);
}
else if (reader.name() == QLatin1String("serAx")) // choose one : catAx, dateAx, serAx, valAx
{
loadXmlAxisSerAx(reader);
}
else if (reader.name() == QLatin1String("valAx")) // choose one : catAx, dateAx, serAx, valAx
{
// qDebug() << QTime::currentTime() << reader.name().toString();
loadXmlAxisValAx(reader);
}
else if (reader.name() == QLatin1String("dTable"))
{
//!ToDo
// dTable "CT_DTable"
reader.skipCurrentElement();
}
else if (reader.name() == QLatin1String("spPr"))
{
//!ToDo
// spPr "a:CT_ShapeProperties"
reader.skipCurrentElement();
}
else if (reader.name() == QLatin1String("extLst"))
{
//!ToDo
// extLst "CT_ExtensionList"
reader.skipCurrentElement();
} }
return true; return true;
@ -907,11 +925,16 @@ void ChartPrivate::saveXmlScatterChart(QXmlStreamWriter &writer) const
if (axisList.isEmpty()) if (axisList.isEmpty())
{ {
const_cast<ChartPrivate*>(this)->axisList.append(QSharedPointer<XlsxAxis>(new XlsxAxis(XlsxAxis::T_Val, XlsxAxis::Bottom, 0, 1, axisNames[XlsxAxis::Bottom] ))); const_cast<ChartPrivate*>(this)->axisList.append(
const_cast<ChartPrivate*>(this)->axisList.append(QSharedPointer<XlsxAxis>(new XlsxAxis(XlsxAxis::T_Val, XlsxAxis::Left, 1, 0, axisNames[XlsxAxis::Left] ))); QSharedPointer<XlsxAxis>(
new XlsxAxis(XlsxAxis::T_Val, XlsxAxis::Bottom, 0, 1, axisNames[XlsxAxis::Bottom] )));
const_cast<ChartPrivate*>(this)->axisList.append(
QSharedPointer<XlsxAxis>(
new XlsxAxis(XlsxAxis::T_Val, XlsxAxis::Left, 1, 0, axisNames[XlsxAxis::Left] )));
} }
Q_ASSERT(axisList.size()==2); int axisListSize = axisList.size();
Q_ASSERT(axisListSize == 2);
for (int i=0; i<axisList.size(); ++i) for (int i=0; i<axisList.size(); ++i)
{ {
@ -1002,56 +1025,6 @@ void ChartPrivate::saveXmlSer(QXmlStreamWriter &writer, XlsxSeries *ser, int id)
writer.writeEndElement();//c:ser writer.writeEndElement();//c:ser
} }
bool ChartPrivate::loadXmlAxis(QXmlStreamReader &reader)
{
Q_ASSERT(reader.name().endsWith(QLatin1String("Ax")));
QString name = reader.name().toString();
XlsxAxis* axis = new XlsxAxis();
// valAx, catAx, serAx, dateAx (choose one)
if (name == QLatin1String("valAx")) { axis->type = XlsxAxis::T_Val; }
else if (name == QLatin1String("catAx")) { axis->type = XlsxAxis::T_Cat; }
else if (name == QLatin1String("serAx")) { axis->type = XlsxAxis::T_Ser; }
else if (name == QLatin1String("dateAx")) { axis->type = XlsxAxis::T_Date; }
else { axis->type = XlsxAxis::T_None; }
axisList.append( QSharedPointer<XlsxAxis>(axis) );
while ( !reader.atEnd() )
{
reader.readNextStartElement();
if ( reader.tokenType() == QXmlStreamReader::StartElement )
{
if ( reader.name() == QLatin1String("axPos") )
{
QXmlStreamAttributes attrs = reader.attributes();
QStringRef pos = attrs.value(QLatin1String("val"));
if ( pos == QLatin1String("l") ) { axis->axisPos = XlsxAxis::Left; }
else if ( pos == QLatin1String("r") ) { axis->axisPos = XlsxAxis::Right; }
else if ( pos == QLatin1String("b") ) { axis->axisPos = XlsxAxis::Bottom; }
else if ( pos == QLatin1String("t") ) { axis->axisPos = XlsxAxis::Top; }
else { axis->axisPos = XlsxAxis::None; }
}
else if ( reader.name() == QLatin1String("axId") )
{
axis->axisId = reader.attributes().value(QLatin1String("val")).toString().toInt();
}
else if ( reader.name() == QLatin1String("crossAx") )
{
axis->crossAx = reader.attributes().value(QLatin1String("val")).toString().toInt();
}
}
else if ( reader.tokenType() == QXmlStreamReader::EndElement
&& reader.name() == name )
{
break;
}
}
return true;
}
bool ChartPrivate::loadXmlAxisCatAx(QXmlStreamReader &reader) bool ChartPrivate::loadXmlAxisCatAx(QXmlStreamReader &reader)
{ {
@ -1129,24 +1102,16 @@ bool ChartPrivate::loadXmlAxisSerAx(QXmlStreamReader &reader)
bool ChartPrivate::loadXmlAxisValAx(QXmlStreamReader &reader) bool ChartPrivate::loadXmlAxisValAx(QXmlStreamReader &reader)
{ {
Q_ASSERT(reader.name() == QLatin1String("valAx"));
XlsxAxis* axis = new XlsxAxis(); XlsxAxis* axis = new XlsxAxis();
axis->type = XlsxAxis::T_Val; axis->type = XlsxAxis::T_Val;
axisList.append( QSharedPointer<XlsxAxis>(axis) ); axisList.append( QSharedPointer<XlsxAxis>(axis) );
// reader.readNext(); if ( ! loadXmlAxisEG_AxShared( reader, axis ) )
while(!(reader.tokenType() == QXmlStreamReader::EndElement &&
reader.name() == "valAx"))
{ {
// load EG_AxShared // qDebug() << "failed to load EG_AxShared";
if ( ! loadXmlAxisEG_AxShared( reader, axis ) ) // return false;
{
// qDebug() << "failed to load EG_AxShared";
// return false;
}
reader.readNext();
} }
//!TODO: load element //!TODO: load element
@ -1159,62 +1124,58 @@ bool ChartPrivate::loadXmlAxisValAx(QXmlStreamReader &reader)
return true; return true;
} }
/*
<xsd:group name="EG_AxShared">
<xsd:sequence>
<xsd:element name="axId" type="CT_UnsignedInt" minOccurs="1" maxOccurs="1"/> (*)(M)
<xsd:element name="scaling" type="CT_Scaling" minOccurs="1" maxOccurs="1"/> (*)(M)
<xsd:element name="delete" type="CT_Boolean" minOccurs="0" maxOccurs="1"/>
<xsd:element name="axPos" type="CT_AxPos" minOccurs="1" maxOccurs="1"/> (*)(M)
<xsd:element name="majorGridlines" type="CT_ChartLines" minOccurs="0" maxOccurs="1"/>
<xsd:element name="minorGridlines" type="CT_ChartLines" minOccurs="0" maxOccurs="1"/>
<xsd:element name="title" type="CT_Title" minOccurs="0" maxOccurs="1"/> (*)
<xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0" maxOccurs="1"/>
<xsd:element name="majorTickMark" type="CT_TickMark" minOccurs="0" maxOccurs="1"/>
<xsd:element name="minorTickMark" type="CT_TickMark" minOccurs="0" maxOccurs="1"/>
<xsd:element name="tickLblPos" type="CT_TickLblPos" minOccurs="0" maxOccurs="1"/>
<xsd:element name="spPr" type="a:CT_ShapeProperties" minOccurs="0" maxOccurs="1"/>
<xsd:element name="txPr" type="a:CT_TextBody" minOccurs="0" maxOccurs="1"/>
<xsd:element name="crossAx" type="CT_UnsignedInt" minOccurs="1" maxOccurs="1"/> (*)(M)
<xsd:choice minOccurs="0" maxOccurs="1">
<xsd:element name="crosses" type="CT_Crosses" minOccurs="1" maxOccurs="1"/>
<xsd:element name="crossesAt" type="CT_Double" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:sequence>
</xsd:group>
*/
bool ChartPrivate::loadXmlAxisEG_AxShared(QXmlStreamReader &reader, XlsxAxis* axis) bool ChartPrivate::loadXmlAxisEG_AxShared(QXmlStreamReader &reader, XlsxAxis* axis)
{ {
if ( NULL == axis ) Q_ASSERT( NULL != axis );
return false; Q_ASSERT(reader.name() == QLatin1String("valAx"));
/*
<xsd:group name="EG_AxShared">
<xsd:sequence>
<xsd:element name="axId" type="CT_UnsignedInt" minOccurs="1" maxOccurs="1"/> (*)(M)
<xsd:element name="scaling" type="CT_Scaling" minOccurs="1" maxOccurs="1"/> (*)(M)
<xsd:element name="delete" type="CT_Boolean" minOccurs="0" maxOccurs="1"/>
<xsd:element name="axPos" type="CT_AxPos" minOccurs="1" maxOccurs="1"/> (*)(M)
<xsd:element name="majorGridlines" type="CT_ChartLines" minOccurs="0" maxOccurs="1"/>
<xsd:element name="minorGridlines" type="CT_ChartLines" minOccurs="0" maxOccurs="1"/>
<xsd:element name="title" type="CT_Title" minOccurs="0" maxOccurs="1"/> (*)
<xsd:element name="numFmt" type="CT_NumFmt" minOccurs="0" maxOccurs="1"/>
<xsd:element name="majorTickMark" type="CT_TickMark" minOccurs="0" maxOccurs="1"/>
<xsd:element name="minorTickMark" type="CT_TickMark" minOccurs="0" maxOccurs="1"/>
<xsd:element name="tickLblPos" type="CT_TickLblPos" minOccurs="0" maxOccurs="1"/>
<xsd:element name="spPr" type="a:CT_ShapeProperties" minOccurs="0" maxOccurs="1"/>
<xsd:element name="txPr" type="a:CT_TextBody" minOccurs="0" maxOccurs="1"/>
<xsd:element name="crossAx" type="CT_UnsignedInt" minOccurs="1" maxOccurs="1"/> (*)(M)
<xsd:choice minOccurs="0" maxOccurs="1">
<xsd:element name="crosses" type="CT_Crosses" minOccurs="1" maxOccurs="1"/>
<xsd:element name="crossesAt" type="CT_Double" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:sequence>
</xsd:group>
*/
QString name = reader.name().toString();
if ( name.isEmpty() )
return false;
while ( !reader.atEnd() ) while ( !reader.atEnd() )
{ {
reader.readNextStartElement(); reader.readNextStartElement();
if ( reader.tokenType() == QXmlStreamReader::StartElement ) if ( reader.tokenType() == QXmlStreamReader::StartElement )
{ {
// qDebug() << "[debug]" << QTime::currentTime() << reader.name().toString();
if ( reader.name() == QLatin1String("axId") ) if ( reader.name() == QLatin1String("axId") )
{ {
// mandatory element // mandatory element
QString axIdValue = reader.readElementText(); int axId = reader.attributes().value("val").toInt();
int axId = axIdValue.toInt();
axis->axisId = axId; axis->axisId = axId;
} }
else if ( reader.name() == QLatin1String("scaling") ) else if ( reader.name() == QLatin1String("scaling") )
{ {
// mandatory element // mandatory element
QString strOrientation = reader.attributes().value(QLatin1String("orientation")).toString(); loadXmlAxisEG_AxShared_Scaling(reader, axis);
// minMax or maxMin
} }
else if ( reader.name() == QLatin1String("delete") ) else if ( reader.name() == QLatin1String("delete") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("axPos") ) else if ( reader.name() == QLatin1String("axPos") )
{ {
@ -1226,13 +1187,14 @@ bool ChartPrivate::loadXmlAxisEG_AxShared(QXmlStreamReader &reader, XlsxAxis* ax
else if ( axPosVal == "r" ) { axis->axisPos = XlsxAxis::Right; } else if ( axPosVal == "r" ) { axis->axisPos = XlsxAxis::Right; }
else if ( axPosVal == "t" ) { axis->axisPos = XlsxAxis::Top; } else if ( axPosVal == "t" ) { axis->axisPos = XlsxAxis::Top; }
else if ( axPosVal == "b" ) { axis->axisPos = XlsxAxis::Bottom; } else if ( axPosVal == "b" ) { axis->axisPos = XlsxAxis::Bottom; }
} }
else if ( reader.name() == QLatin1String("majorGridlines") ) else if ( reader.name() == QLatin1String("majorGridlines") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("minorGridlines") ) else if ( reader.name() == QLatin1String("minorGridlines") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("title") ) else if ( reader.name() == QLatin1String("title") )
{ {
@ -1240,43 +1202,54 @@ bool ChartPrivate::loadXmlAxisEG_AxShared(QXmlStreamReader &reader, XlsxAxis* ax
if ( !loadXmlAxisEG_AxShared_Title(reader, axis) ) if ( !loadXmlAxisEG_AxShared_Title(reader, axis) )
{ {
qDebug() << "failed to load EG_AxShared title."; qDebug() << "failed to load EG_AxShared title.";
Q_ASSERT(false);
return false; return false;
} }
} }
else if ( reader.name() == QLatin1String("numFmt") ) else if ( reader.name() == QLatin1String("numFmt") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("majorTickMark") ) else if ( reader.name() == QLatin1String("majorTickMark") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("minorTickMark") ) else if ( reader.name() == QLatin1String("minorTickMark") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("tickLblPos") ) else if ( reader.name() == QLatin1String("tickLblPos") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("spPr") ) else if ( reader.name() == QLatin1String("spPr") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("txPr") ) else if ( reader.name() == QLatin1String("txPr") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("crossAx") ) else if ( reader.name() == QLatin1String("crossAx") )
{ {
// mandatory element // mandatory element
int crossAx = reader.attributes().value(QLatin1String("crossAx")).toInt(); int crossAx = reader.attributes().value(QLatin1String("val")).toInt();
axis->crossAx = crossAx; axis->crossAx = crossAx;
} }
else if ( reader.name() == QLatin1String("crosses") ) else if ( reader.name() == QLatin1String("crosses") )
{ {
//!TODO
} }
else if ( reader.name() == QLatin1String("crossesAt") ) else if ( reader.name() == QLatin1String("crossesAt") )
{ {
//!TODO
} }
// reader.readNext();
} }
else if ( reader.tokenType() == QXmlStreamReader::EndElement else if ( reader.tokenType() == QXmlStreamReader::EndElement &&
&& reader.name() == name ) reader.name() == "valAx" )
{ {
break; break;
} }
@ -1285,45 +1258,74 @@ bool ChartPrivate::loadXmlAxisEG_AxShared(QXmlStreamReader &reader, XlsxAxis* ax
return true; return true;
} }
bool ChartPrivate::loadXmlAxisEG_AxShared_Scaling(QXmlStreamReader &reader, XlsxAxis* axis)
{
Q_ASSERT(reader.name() == QLatin1String("scaling"));
while ( !reader.atEnd() )
{
reader.readNextStartElement();
if ( reader.tokenType() == QXmlStreamReader::StartElement )
{
if ( reader.name() == QLatin1String("orientation") )
{
QString strOrientation = reader.attributes().value(QLatin1String("val")).toString();
int debugLine = 0;
}
else
{
}
}
else if ( reader.tokenType() == QXmlStreamReader::EndElement &&
reader.name() == "scaling" )
{
break;
}
}
return true;
}
/*
<xsd:complexType name="CT_Title">
<xsd:sequence>
<xsd:element name="tx" type="CT_Tx" minOccurs="0" maxOccurs="1"/>
<xsd:element name="layout" type="CT_Layout" minOccurs="0" maxOccurs="1"/>
<xsd:element name="overlay" type="CT_Boolean" minOccurs="0" maxOccurs="1"/>
<xsd:element name="spPr" type="a:CT_ShapeProperties" minOccurs="0" maxOccurs="1"/>
<xsd:element name="txPr" type="a:CT_TextBody" minOccurs="0" maxOccurs="1"/>
<xsd:element name="extLst" type="CT_ExtensionList" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CT_Tx">
<xsd:sequence>
<xsd:choice minOccurs="1" maxOccurs="1">
<xsd:element name="strRef" type="CT_StrRef" minOccurs="1" maxOccurs="1"/>
<xsd:element name="rich" type="a:CT_TextBody" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CT_StrRef">
<xsd:sequence>
<xsd:element name="f" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="strCache" type="CT_StrData" minOccurs="0" maxOccurs="1"/>
<xsd:element name="extLst" type="CT_ExtensionList" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CT_TextBody">
<xsd:sequence>
<xsd:element name="bodyPr" type="CT_TextBodyProperties" minOccurs="1" maxOccurs="1"/>
<xsd:element name="lstStyle" type="CT_TextListStyle" minOccurs="0" maxOccurs="1"/>
<xsd:element name="p" type="CT_TextParagraph" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
*/
bool ChartPrivate::loadXmlAxisEG_AxShared_Title(QXmlStreamReader &reader, XlsxAxis* axis) bool ChartPrivate::loadXmlAxisEG_AxShared_Title(QXmlStreamReader &reader, XlsxAxis* axis)
{ {
/* Q_ASSERT(reader.name() == QLatin1String("title"));
<xsd:complexType name="CT_Title">
<xsd:sequence>
<xsd:element name="tx" type="CT_Tx" minOccurs="0" maxOccurs="1"/>
<xsd:element name="layout" type="CT_Layout" minOccurs="0" maxOccurs="1"/>
<xsd:element name="overlay" type="CT_Boolean" minOccurs="0" maxOccurs="1"/>
<xsd:element name="spPr" type="a:CT_ShapeProperties" minOccurs="0" maxOccurs="1"/>
<xsd:element name="txPr" type="a:CT_TextBody" minOccurs="0" maxOccurs="1"/>
<xsd:element name="extLst" type="CT_ExtensionList" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CT_Tx">
<xsd:sequence>
<xsd:choice minOccurs="1" maxOccurs="1">
<xsd:element name="strRef" type="CT_StrRef" minOccurs="1" maxOccurs="1"/>
<xsd:element name="rich" type="a:CT_TextBody" minOccurs="1" maxOccurs="1"/>
</xsd:choice>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CT_StrRef">
<xsd:sequence>
<xsd:element name="f" type="xsd:string" minOccurs="1" maxOccurs="1"/>
<xsd:element name="strCache" type="CT_StrData" minOccurs="0" maxOccurs="1"/>
<xsd:element name="extLst" type="CT_ExtensionList" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="CT_TextBody">
<xsd:sequence>
<xsd:element name="bodyPr" type="CT_TextBodyProperties" minOccurs="1" maxOccurs="1"/>
<xsd:element name="lstStyle" type="CT_TextListStyle" minOccurs="0" maxOccurs="1"/>
<xsd:element name="p" type="CT_TextParagraph" minOccurs="1" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
*/
while ( !reader.atEnd() ) while ( !reader.atEnd() )
{ {
@ -1336,6 +1338,8 @@ bool ChartPrivate::loadXmlAxisEG_AxShared_Title(QXmlStreamReader &reader, XlsxAx
} }
else if ( reader.name() == QLatin1String("overlay") ) else if ( reader.name() == QLatin1String("overlay") )
{ {
//!TODO: load overlay
loadXmlAxisEG_AxShared_Title_Overlay(reader, axis);
} }
else else
{ {
@ -1351,8 +1355,30 @@ bool ChartPrivate::loadXmlAxisEG_AxShared_Title(QXmlStreamReader &reader, XlsxAx
return true; return true;
} }
bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Overlay(QXmlStreamReader &reader, XlsxAxis* axis)
{
Q_ASSERT(reader.name() == QLatin1String("overlay"));
while ( !reader.atEnd() )
{
reader.readNextStartElement();
if ( reader.tokenType() == QXmlStreamReader::StartElement )
{
}
else if ( reader.tokenType() == QXmlStreamReader::EndElement &&
reader.name() == "overlay" )
{
break;
}
}
return true;
}
bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx(QXmlStreamReader &reader, XlsxAxis* axis) bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx(QXmlStreamReader &reader, XlsxAxis* axis)
{ {
Q_ASSERT(reader.name() == QLatin1String("tx"));
while ( !reader.atEnd() ) while ( !reader.atEnd() )
{ {
reader.readNextStartElement(); reader.readNextStartElement();
@ -1378,6 +1404,8 @@ bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx(QXmlStreamReader &reader, Xls
bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich(QXmlStreamReader &reader, XlsxAxis* axis) bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich(QXmlStreamReader &reader, XlsxAxis* axis)
{ {
Q_ASSERT(reader.name() == QLatin1String("rich"));
while ( !reader.atEnd() ) while ( !reader.atEnd() )
{ {
reader.readNextStartElement(); reader.readNextStartElement();
@ -1403,6 +1431,8 @@ bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich(QXmlStreamReader &reader
bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich_P(QXmlStreamReader &reader, XlsxAxis* axis) bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich_P(QXmlStreamReader &reader, XlsxAxis* axis)
{ {
Q_ASSERT(reader.name() == QLatin1String("p"));
while ( !reader.atEnd() ) while ( !reader.atEnd() )
{ {
reader.readNextStartElement(); reader.readNextStartElement();
@ -1410,10 +1440,15 @@ bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich_P(QXmlStreamReader &read
{ {
if ( reader.name() == QLatin1String("r") ) if ( reader.name() == QLatin1String("r") )
{ {
loadXmlAxisEG_AxShared_Title_Tx_Rich_P_T(reader, axis); loadXmlAxisEG_AxShared_Title_Tx_Rich_P_R(reader, axis);
}
else if ( reader.name() == QLatin1String("pPr") )
{
loadXmlAxisEG_AxShared_Title_Tx_Rich_P_pPr(reader, axis);
} }
else else
{ {
} }
} }
else if ( reader.tokenType() == QXmlStreamReader::EndElement && else if ( reader.tokenType() == QXmlStreamReader::EndElement &&
@ -1426,8 +1461,38 @@ bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich_P(QXmlStreamReader &read
return true; return true;
} }
bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich_P_T(QXmlStreamReader &reader, XlsxAxis* axis) bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich_P_pPr(QXmlStreamReader &reader, XlsxAxis* axis)
{ {
Q_ASSERT(reader.name() == QLatin1String("pPr"));
while ( !reader.atEnd() )
{
reader.readNextStartElement();
if ( reader.tokenType() == QXmlStreamReader::StartElement )
{
if ( reader.name() == QLatin1String("defRPr") )
{
QString strDefRPr = reader.readElementText();
int debugLine = 0;
}
else
{
}
}
else if ( reader.tokenType() == QXmlStreamReader::EndElement &&
reader.name() == "pPr" )
{
break;
}
}
return true;
}
bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich_P_R(QXmlStreamReader &reader, XlsxAxis* axis)
{
Q_ASSERT(reader.name() == QLatin1String("r"));
while ( !reader.atEnd() ) while ( !reader.atEnd() )
{ {
reader.readNextStartElement(); reader.readNextStartElement();
@ -1444,7 +1509,7 @@ bool ChartPrivate::loadXmlAxisEG_AxShared_Title_Tx_Rich_P_T(QXmlStreamReader &re
} }
} }
else if ( reader.tokenType() == QXmlStreamReader::EndElement && else if ( reader.tokenType() == QXmlStreamReader::EndElement &&
reader.name() == "t" ) reader.name() == "r" )
{ {
break; break;
} }

View File

@ -35,29 +35,33 @@ Travis CI | AppVeyor | CodeFactor
## 할 일 ## 할 일
<details><summary>CLICK ME</summary>
<p>
- [테스트 할 일](ToTest.md) - [테스트 할 일](ToTest.md)
- [업그레이드 할 일](ToUpgrade.md) - [업그레이드 할 일](ToUpgrade.md)
</p>
</details>
## 컨트리뷰터 ## 컨트리뷰터
- [컨트리뷰터](https://github.com/QtExcel/QXlsx/graphs/contributors) 참조. - [컨트리뷰터](https://github.com/QtExcel/QXlsx/graphs/contributors) 참조.
## 라이센스와 링크 ## 라이센스와 링크
- QXlsx 는 MIT 라이센스 입니다. [https://github.com/QtExcel/QXlsx](https://github.com/QtExcel/QXlsx) - QXlsx 는 MIT 라이센스 입니다. [https://github.com/QtExcel/QXlsx](https://github.com/QtExcel/QXlsx)
- QtXlsx 는 MIT 라이센스 입니다. [https://github.com/dbzhang800/QtXlsxWriter](https://github.com/dbzhang800/QtXlsxWriter) - QtXlsx 는 MIT 라이센스 입니다. [https://github.com/dbzhang800/QtXlsxWriter](https://github.com/dbzhang800/QtXlsxWriter)
- Qt-Table-Printer 는 BSD 3-Clause 라이센스 입니다. [https://github.com/T0ny0/Qt-Table-Printer](https://github.com/T0ny0/Qt-Table-Printer) - Qt-Table-Printer 는 BSD 3-Clause 라이센스 입니다. [https://github.com/T0ny0/Qt-Table-Printer](https://github.com/T0ny0/Qt-Table-Printer)
- recurse 는 MIT 라이센스 입니다. [https://github.com/pkoretic/recurse](https://github.com/pkoretic/recurse) - recurse 는 MIT 라이센스 입니다. [https://github.com/pkoretic/recurse](https://github.com/pkoretic/recurse)
- Qt 는 LGPL v3 라이센스 또는 상업용 라이센스 입니다. [https://www.qt.io/](https://www.qt.io/) - Qt 는 LGPL v3 라이센스 또는 상업용 라이센스 입니다. [https://www.qt.io/](https://www.qt.io/)
## :email: 문의 ## :email: 문의
- 이슈를 남겨 주세요. [https://github.com/QtExcel/QXlsx/issues](https://github.com/QtExcel/QXlsx/issues) - 이슈를 남겨 주세요. [https://github.com/QtExcel/QXlsx/issues](https://github.com/QtExcel/QXlsx/issues)
- 프로젝트 참여에 관심이 있으신 분은 이슈로 연락주세요. - 프로젝트 참여에 관심이 있으신 분은 이슈로 연락주세요.
- README.md를 모국어로 번역하려면 저에게 연락하십시오. - README.md를 모국어로 번역하려면 저에게 연락하십시오.
- 이슈(issue)를 제기하거나 pull request를 사용하시면 됩니다. (예: README.ko.md) - 이슈(issue)를 제기하거나 pull request를 사용하시면 됩니다. (예: README.ko.md)

View File

@ -11,7 +11,7 @@
## How to use ## How to use
- See [examples](Example.md) - See [examples](Example.md)
- HelloWorld : Hello world example (the most basic structure) - [HelloWorld](HelloWorld/) : Hello world example (the most basic structure)
- TestExcel : basic samples based on QtXlsx samples - TestExcel : basic samples based on QtXlsx samples
- HelloAndroid : read xlsx on Android - HelloAndroid : read xlsx on Android
- Copycat : load xlsx file and display on widget. print xlsx file. - Copycat : load xlsx file and display on widget. print xlsx file.
@ -35,24 +35,24 @@ Travis CI | AppVeyor | CodeFactor
## To Do ## To Do
<details><summary>CLICK ME</summary>
<p>
- [To test](ToTest.md) - [To test](ToTest.md)
- [What to upgrade](ToUpgrade.md). - [What to upgrade](ToUpgrade.md).
</p>
</details>
## Contributions ## Contributions
- See [contributors](https://github.com/QtExcel/QXlsx/graphs/contributors). - See [contributors](https://github.com/QtExcel/QXlsx/graphs/contributors).
## License and links ## License and links
- QXlsx is under MIT license. [https://github.com/QtExcel/QXlsx](https://github.com/QtExcel/QXlsx) - QXlsx is under MIT license. [https://github.com/QtExcel/QXlsx](https://github.com/QtExcel/QXlsx)
- QtXlsx is under MIT license. [https://github.com/dbzhang800/QtXlsxWriter](https://github.com/dbzhang800/QtXlsxWriter) - QtXlsx is under MIT license. [https://github.com/dbzhang800/QtXlsxWriter](https://github.com/dbzhang800/QtXlsxWriter)
- Qt-Table-Printer is under BSD 3-Clause license. [https://github.com/T0ny0/Qt-Table-Printer](https://github.com/T0ny0/Qt-Table-Printer) - Qt-Table-Printer is under BSD 3-Clause license. [https://github.com/T0ny0/Qt-Table-Printer](https://github.com/T0ny0/Qt-Table-Printer)
- recurse is under MIT license. [https://github.com/pkoretic/recurse](https://github.com/pkoretic/recurse) - recurse is under MIT license. [https://github.com/pkoretic/recurse](https://github.com/pkoretic/recurse)
- Qt is under LGPL v3 license or Commercial license. [https://www.qt.io/](https://www.qt.io/) - Qt is under LGPL v3 license or Commercial license. [https://www.qt.io/](https://www.qt.io/)
## :email: Contact ## :email: Contact