andre@1: /**************************************************************************** andre@1: ** Copyright (c) 2013-2014 Debao Zhang andre@1: ** All right reserved. andre@1: ** andre@1: ** Permission is hereby granted, free of charge, to any person obtaining andre@1: ** a copy of this software and associated documentation files (the andre@1: ** "Software"), to deal in the Software without restriction, including andre@1: ** without limitation the rights to use, copy, modify, merge, publish, andre@1: ** distribute, sublicense, and/or sell copies of the Software, and to andre@1: ** permit persons to whom the Software is furnished to do so, subject to andre@1: ** the following conditions: andre@1: ** andre@1: ** The above copyright notice and this permission notice shall be andre@1: ** included in all copies or substantial portions of the Software. andre@1: ** andre@1: ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, andre@1: ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF andre@1: ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND andre@1: ** NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE andre@1: ** LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION andre@1: ** OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION andre@1: ** WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. andre@1: ** andre@1: ****************************************************************************/ andre@1: andre@1: #include "xlsxchart_p.h" andre@1: #include "xlsxworksheet.h" andre@1: #include "xlsxcellrange.h" andre@1: #include "xlsxutility_p.h" andre@1: andre@1: #include andre@1: #include andre@1: #include andre@1: #include andre@1: andre@1: QT_BEGIN_NAMESPACE_XLSX andre@1: andre@1: ChartPrivate::ChartPrivate(Chart *q, Chart::CreateFlag flag) andre@1: :AbstractOOXmlFilePrivate(q, flag), chartType(static_cast(0)) andre@1: { andre@1: andre@1: } andre@1: andre@1: ChartPrivate::~ChartPrivate() andre@1: { andre@1: andre@1: } andre@1: andre@1: /*! andre@1: * \class Chart andre@1: * \inmodule QtXlsx andre@1: * \brief Main class for the charts. andre@1: */ andre@1: andre@1: /*! andre@1: \enum Chart::ChartType andre@1: andre@1: \value CT_Area andre@1: \value CT_Area3D, andre@1: \value CT_Line, andre@1: \value CT_Line3D, andre@1: \value CT_Scatter, andre@1: \value CT_Pie, andre@1: \value CT_Pie3D, andre@1: \value CT_Doughnut, andre@1: \value CT_Bar, andre@1: \value CT_Bar3D, andre@1: andre@1: \omitvalue CT_Stock, andre@1: \omitvalue CT_Radar, andre@1: \omitvalue CT_OfPie, andre@1: \omitvalue CT_Surface, andre@1: \omitvalue CT_Surface3D, andre@1: \omitvalue CT_Bubble andre@1: */ andre@1: andre@1: /*! andre@1: * \internal andre@1: */ andre@1: Chart::Chart(AbstractSheet *parent, CreateFlag flag) andre@1: :AbstractOOXmlFile(new ChartPrivate(this, flag)) andre@1: { andre@1: d_func()->sheet = parent; andre@1: } andre@1: andre@1: /*! andre@1: * Destroys the chart. andre@1: */ andre@1: Chart::~Chart() andre@1: { andre@1: } andre@1: andre@1: /*! andre@1: * Add the data series which is in the range \a range of the \a sheet. andre@1: */ andre@1: void Chart::addSeries(const CellRange &range, AbstractSheet *sheet) andre@1: { andre@1: Q_D(Chart); andre@1: if (!range.isValid()) andre@1: return; andre@1: if (sheet && sheet->sheetType() != AbstractSheet::ST_WorkSheet) andre@1: return; andre@1: if (!sheet && d->sheet->sheetType() != AbstractSheet::ST_WorkSheet) andre@1: return; andre@1: andre@1: QString sheetName = sheet ? sheet->sheetName() : d->sheet->sheetName(); andre@1: //In case sheetName contains space or ' andre@1: sheetName = escapeSheetName(sheetName); andre@1: andre@1: if (range.columnCount() == 1 || range.rowCount() == 1) { andre@1: QSharedPointer series = QSharedPointer(new XlsxSeries); andre@1: series->numberDataSource_numRef = sheetName + QLatin1String("!") + range.toString(true, true); andre@1: d->seriesList.append(series); andre@1: } else if (range.columnCount() < range.rowCount()) { andre@1: //Column based series andre@1: int firstDataColumn = range.firstColumn(); andre@1: QString axDataSouruce_numRef; andre@1: if (d->chartType == CT_Scatter || d->chartType == CT_Bubble) { andre@1: firstDataColumn += 1; andre@1: CellRange subRange(range.firstRow(), range.firstColumn(), range.lastRow(), range.firstColumn()); andre@1: axDataSouruce_numRef = sheetName + QLatin1String("!") + subRange.toString(true, true); andre@1: } andre@1: andre@1: for (int col=firstDataColumn; col<=range.lastColumn(); ++col) { andre@1: CellRange subRange(range.firstRow(), col, range.lastRow(), col); andre@1: QSharedPointer series = QSharedPointer(new XlsxSeries); andre@1: series->axDataSource_numRef = axDataSouruce_numRef; andre@1: series->numberDataSource_numRef = sheetName + QLatin1String("!") + subRange.toString(true, true); andre@1: d->seriesList.append(series); andre@1: } andre@1: andre@1: } else { andre@1: //Row based series andre@1: int firstDataRow = range.firstRow(); andre@1: QString axDataSouruce_numRef; andre@1: if (d->chartType == CT_Scatter || d->chartType == CT_Bubble) { andre@1: firstDataRow += 1; andre@1: CellRange subRange(range.firstRow(), range.firstColumn(), range.firstRow(), range.lastColumn()); andre@1: axDataSouruce_numRef = sheetName + QLatin1String("!") + subRange.toString(true, true); andre@1: } andre@1: andre@1: for (int row=firstDataRow; row<=range.lastRow(); ++row) { andre@1: CellRange subRange(row, range.firstColumn(), row, range.lastColumn()); andre@1: QSharedPointer series = QSharedPointer(new XlsxSeries); andre@1: series->axDataSource_numRef = axDataSouruce_numRef; andre@1: series->numberDataSource_numRef = sheetName + QLatin1String("!") + subRange.toString(true, true); andre@1: d->seriesList.append(series); andre@1: } andre@1: } andre@1: } andre@1: andre@1: /*! andre@1: * Set the type of the chart to \a type andre@1: */ andre@1: void Chart::setChartType(ChartType type) andre@1: { andre@1: Q_D(Chart); andre@1: d->chartType = type; andre@1: } andre@1: andre@1: /*! andre@1: * \internal andre@1: * andre@1: */ andre@1: void Chart::setChartStyle(int id) andre@1: { andre@1: Q_UNUSED(id) andre@1: //!Todo andre@1: } andre@1: andre@1: /*! andre@1: * \internal andre@1: */ andre@1: void Chart::saveToXmlFile(QIODevice *device) const andre@1: { andre@1: Q_D(const Chart); andre@1: andre@1: QXmlStreamWriter writer(device); andre@1: andre@1: writer.writeStartDocument(QStringLiteral("1.0"), true); andre@1: writer.writeStartElement(QStringLiteral("c:chartSpace")); andre@1: writer.writeAttribute(QStringLiteral("xmlns:c"), QStringLiteral("http://schemas.openxmlformats.org/drawingml/2006/chart")); andre@1: writer.writeAttribute(QStringLiteral("xmlns:a"), QStringLiteral("http://schemas.openxmlformats.org/drawingml/2006/main")); andre@1: writer.writeAttribute(QStringLiteral("xmlns:r"), QStringLiteral("http://schemas.openxmlformats.org/officeDocument/2006/relationships")); andre@1: andre@1: d->saveXmlChart(writer); andre@1: andre@1: writer.writeEndElement();//c:chartSpace andre@1: writer.writeEndDocument(); andre@1: } andre@1: andre@1: /*! andre@1: * \internal andre@1: */ andre@1: bool Chart::loadFromXmlFile(QIODevice *device) andre@1: { andre@1: Q_D(Chart); andre@1: andre@1: QXmlStreamReader reader(device); andre@1: while (!reader.atEnd()) { andre@1: reader.readNextStartElement(); andre@1: if (reader.tokenType() == QXmlStreamReader::StartElement) { andre@1: if (reader.name() == QLatin1String("chart")) { andre@1: if (!d->loadXmlChart(reader)) andre@1: return false; andre@1: } andre@1: } andre@1: } andre@1: return true; andre@1: } andre@1: andre@1: bool ChartPrivate::loadXmlChart(QXmlStreamReader &reader) andre@1: { andre@1: Q_ASSERT(reader.name() == QLatin1String("chart")); andre@1: andre@1: while (!reader.atEnd()) { andre@1: reader.readNextStartElement(); andre@1: if (reader.tokenType() == QXmlStreamReader::StartElement) { andre@1: if (reader.name() == QLatin1String("plotArea")) { andre@1: if (!loadXmlPlotArea(reader)) andre@1: return false; andre@1: } else if (reader.name() == QLatin1String("legend")) { andre@1: //!Todo andre@1: } andre@1: } else if (reader.tokenType() == QXmlStreamReader::EndElement && andre@1: reader.name() == QLatin1String("chart")) { andre@1: break; andre@1: } andre@1: } andre@1: return true; andre@1: } andre@1: andre@1: bool ChartPrivate::loadXmlPlotArea(QXmlStreamReader &reader) andre@1: { andre@1: Q_ASSERT(reader.name() == QLatin1String("plotArea")); andre@1: andre@1: while (!reader.atEnd()) { andre@1: reader.readNextStartElement(); andre@1: if (reader.tokenType() == QXmlStreamReader::StartElement) { andre@1: if (reader.name() == QLatin1String("layout")) { andre@1: //!ToDo andre@1: } else if (reader.name().endsWith(QLatin1String("Chart"))) { andre@1: //For pieChart, barChart, ... andre@1: loadXmlXxxChart(reader); andre@1: } else if (reader.name().endsWith(QLatin1String("Ax"))) { andre@1: //For valAx, catAx, serAx, dateAx andre@1: loadXmlAxis(reader); andre@1: } andre@1: andre@1: } else if (reader.tokenType() == QXmlStreamReader::EndElement && andre@1: reader.name() == QLatin1String("plotArea")) { andre@1: break; andre@1: } andre@1: } andre@1: return true; andre@1: } andre@1: andre@1: bool ChartPrivate::loadXmlXxxChart(QXmlStreamReader &reader) andre@1: { andre@1: QStringRef name = reader.name(); andre@1: if (name == QLatin1String("pieChart")) chartType = Chart::CT_Pie; andre@1: else if (name == QLatin1String("pie3DChart")) chartType = Chart::CT_Pie3D; andre@1: else if (name == QLatin1String("barChart")) chartType = Chart::CT_Bar; andre@1: else if (name == QLatin1String("bar3DChart")) chartType = Chart::CT_Bar3D; andre@1: else if (name == QLatin1String("lineChart")) chartType = Chart::CT_Line; andre@1: else if (name == QLatin1String("line3DChart")) chartType = Chart::CT_Line3D; andre@1: else if (name == QLatin1String("scatterChart")) chartType = Chart::CT_Scatter; andre@1: else if (name == QLatin1String("areaChart")) chartType = Chart::CT_Area; andre@1: else if (name == QLatin1String("area3DChart")) chartType = Chart::CT_Area3D; andre@1: else if (name == QLatin1String("doughnutChart")) chartType = Chart::CT_Doughnut; andre@1: else qDebug()<<"Cann't load chart: "< series = QSharedPointer(new XlsxSeries); andre@1: seriesList.append(series); andre@1: andre@1: while (!reader.atEnd() && !(reader.tokenType() == QXmlStreamReader::EndElement andre@1: && reader.name() == QLatin1String("ser"))) { andre@1: if (reader.readNextStartElement()) { andre@1: QStringRef name = reader.name(); andre@1: if (name == QLatin1String("cat") || name == QLatin1String("xVal")) { andre@1: while (!reader.atEnd() && !(reader.tokenType() == QXmlStreamReader::EndElement andre@1: && reader.name() == name)) { andre@1: if (reader.readNextStartElement()) { andre@1: if (reader.name() == QLatin1String("numRef")) andre@1: series->axDataSource_numRef = loadXmlNumRef(reader); andre@1: } andre@1: } andre@1: } else if (name == QLatin1String("val") || name == QLatin1String("yVal")) { andre@1: while (!reader.atEnd() && !(reader.tokenType() == QXmlStreamReader::EndElement andre@1: && reader.name() == name)) { andre@1: if (reader.readNextStartElement()) { andre@1: if (reader.name() == QLatin1String("numRef")) andre@1: series->numberDataSource_numRef = loadXmlNumRef(reader); andre@1: } andre@1: } andre@1: } else if (name == QLatin1String("extLst")) { andre@1: while (!reader.atEnd() && !(reader.tokenType() == QXmlStreamReader::EndElement andre@1: && reader.name() == name)) { andre@1: reader.readNextStartElement(); andre@1: } andre@1: } andre@1: } andre@1: } andre@1: andre@1: return true; andre@1: } andre@1: andre@1: andre@1: QString ChartPrivate::loadXmlNumRef(QXmlStreamReader &reader) andre@1: { andre@1: Q_ASSERT(reader.name() == QLatin1String("numRef")); andre@1: andre@1: while (!reader.atEnd() && !(reader.tokenType() == QXmlStreamReader::EndElement andre@1: && reader.name() == QLatin1String("numRef"))) { andre@1: if (reader.readNextStartElement()) { andre@1: if (reader.name() == QLatin1String("f")) andre@1: return reader.readElementText(); andre@1: } andre@1: } andre@1: andre@1: return QString(); andre@1: } andre@1: andre@1: void ChartPrivate::saveXmlChart(QXmlStreamWriter &writer) const andre@1: { andre@1: writer.writeStartElement(QStringLiteral("c:chart")); andre@1: writer.writeStartElement(QStringLiteral("c:plotArea")); andre@1: switch (chartType) { andre@1: case Chart::CT_Pie: andre@1: case Chart::CT_Pie3D: andre@1: saveXmlPieChart(writer); andre@1: break; andre@1: case Chart::CT_Bar: andre@1: case Chart::CT_Bar3D: andre@1: saveXmlBarChart(writer); andre@1: break; andre@1: case Chart::CT_Line: andre@1: case Chart::CT_Line3D: andre@1: saveXmlLineChart(writer); andre@1: break; andre@1: case Chart::CT_Scatter: andre@1: saveXmlScatterChart(writer); andre@1: break; andre@1: case Chart::CT_Area: andre@1: case Chart::CT_Area3D: andre@1: saveXmlAreaChart(writer); andre@1: break; andre@1: case Chart::CT_Doughnut: andre@1: saveXmlDoughnutChart(writer); andre@1: break; andre@1: default: andre@1: break; andre@1: } andre@1: saveXmlAxes(writer); andre@1: writer.writeEndElement(); //plotArea andre@1: andre@1: // saveXmlLegend(writer); andre@1: andre@1: writer.writeEndElement(); //chart andre@1: } andre@1: andre@1: void ChartPrivate::saveXmlPieChart(QXmlStreamWriter &writer) const andre@1: { andre@1: QString name = chartType==Chart::CT_Pie ? QStringLiteral("c:pieChart") : QStringLiteral("c:pie3DChart"); andre@1: andre@1: writer.writeStartElement(name); andre@1: andre@1: //Do the same behavior as Excel, Pie prefer varyColors andre@1: writer.writeEmptyElement(QStringLiteral("c:varyColors")); andre@1: writer.writeAttribute(QStringLiteral("val"), QStringLiteral("1")); andre@1: andre@1: for (int i=0; i(this)->axisList.append(QSharedPointer(new XlsxAxis(XlsxAxis::T_Cat, XlsxAxis::Bottom, 0, 1))); andre@1: const_cast(this)->axisList.append(QSharedPointer(new XlsxAxis(XlsxAxis::T_Val, XlsxAxis::Left, 1, 0))); andre@1: } andre@1: andre@1: //Note: Bar3D have 2~3 axes andre@1: Q_ASSERT(axisList.size()==2 || (axisList.size()==3 && chartType==Chart::CT_Bar3D)); andre@1: andre@1: for (int i=0; iaxisId)); andre@1: } andre@1: andre@1: writer.writeEndElement(); //barChart, bar3DChart andre@1: } andre@1: andre@1: void ChartPrivate::saveXmlLineChart(QXmlStreamWriter &writer) const andre@1: { andre@1: QString name = chartType==Chart::CT_Line ? QStringLiteral("c:lineChart") : QStringLiteral("c:line3DChart"); andre@1: andre@1: writer.writeStartElement(name); andre@1: andre@1: writer.writeEmptyElement(QStringLiteral("grouping")); andre@1: andre@1: for (int i=0; i(this)->axisList.append(QSharedPointer(new XlsxAxis(XlsxAxis::T_Cat, XlsxAxis::Bottom, 0, 1))); andre@1: const_cast(this)->axisList.append(QSharedPointer(new XlsxAxis(XlsxAxis::T_Val, XlsxAxis::Left, 1, 0))); andre@1: if (chartType==Chart::CT_Line3D) andre@1: const_cast(this)->axisList.append(QSharedPointer(new XlsxAxis(XlsxAxis::T_Ser, XlsxAxis::Bottom, 2, 0))); andre@1: } andre@1: andre@1: Q_ASSERT((axisList.size()==2||chartType==Chart::CT_Line)|| (axisList.size()==3 && chartType==Chart::CT_Line3D)); andre@1: andre@1: for (int i=0; iaxisId)); andre@1: } andre@1: andre@1: writer.writeEndElement(); //lineChart, line3DChart andre@1: } andre@1: andre@1: void ChartPrivate::saveXmlScatterChart(QXmlStreamWriter &writer) const andre@1: { andre@1: const QString name = QStringLiteral("c:scatterChart"); andre@1: andre@1: writer.writeStartElement(name); andre@1: andre@1: writer.writeEmptyElement(QStringLiteral("c:scatterStyle")); andre@1: andre@1: for (int i=0; i(this)->axisList.append(QSharedPointer(new XlsxAxis(XlsxAxis::T_Val, XlsxAxis::Bottom, 0, 1))); andre@1: const_cast(this)->axisList.append(QSharedPointer(new XlsxAxis(XlsxAxis::T_Val, XlsxAxis::Left, 1, 0))); andre@1: } andre@1: andre@1: Q_ASSERT(axisList.size()==2); andre@1: andre@1: for (int i=0; iaxisId)); andre@1: } andre@1: andre@1: writer.writeEndElement(); //c:scatterChart andre@1: } andre@1: andre@1: void ChartPrivate::saveXmlAreaChart(QXmlStreamWriter &writer) const andre@1: { andre@1: QString name = chartType==Chart::CT_Area ? QStringLiteral("c:areaChart") : QStringLiteral("c:area3DChart"); andre@1: andre@1: writer.writeStartElement(name); andre@1: andre@1: writer.writeEmptyElement(QStringLiteral("grouping")); andre@1: andre@1: for (int i=0; i(this)->axisList.append(QSharedPointer(new XlsxAxis(XlsxAxis::T_Cat, XlsxAxis::Bottom, 0, 1))); andre@1: const_cast(this)->axisList.append(QSharedPointer(new XlsxAxis(XlsxAxis::T_Val, XlsxAxis::Left, 1, 0))); andre@1: } andre@1: andre@1: //Note: Area3D have 2~3 axes andre@1: Q_ASSERT(axisList.size()==2 || (axisList.size()==3 && chartType==Chart::CT_Area3D)); andre@1: andre@1: for (int i=0; iaxisId)); andre@1: } andre@1: andre@1: writer.writeEndElement(); //lineChart, line3DChart andre@1: } andre@1: andre@1: void ChartPrivate::saveXmlDoughnutChart(QXmlStreamWriter &writer) const andre@1: { andre@1: QString name = QStringLiteral("c:doughnutChart"); andre@1: andre@1: writer.writeStartElement(name); andre@1: andre@1: writer.writeEmptyElement(QStringLiteral("c:varyColors")); andre@1: writer.writeAttribute(QStringLiteral("val"), QStringLiteral("1")); andre@1: andre@1: for (int i=0; iaxDataSource_numRef.isEmpty()) { andre@1: if (chartType == Chart::CT_Scatter || chartType == Chart::CT_Bubble) andre@1: writer.writeStartElement(QStringLiteral("c:xVal")); andre@1: else andre@1: writer.writeStartElement(QStringLiteral("c:cat")); andre@1: writer.writeStartElement(QStringLiteral("c:numRef")); andre@1: writer.writeTextElement(QStringLiteral("c:f"), ser->axDataSource_numRef); andre@1: writer.writeEndElement();//c:numRef andre@1: writer.writeEndElement();//c:cat or c:xVal andre@1: } andre@1: andre@1: if (!ser->numberDataSource_numRef.isEmpty()) { andre@1: if (chartType == Chart::CT_Scatter || chartType == Chart::CT_Bubble) andre@1: writer.writeStartElement(QStringLiteral("c:yVal")); andre@1: else andre@1: writer.writeStartElement(QStringLiteral("c:val")); andre@1: writer.writeStartElement(QStringLiteral("c:numRef")); andre@1: writer.writeTextElement(QStringLiteral("c:f"), ser->numberDataSource_numRef); andre@1: writer.writeEndElement();//c:numRef andre@1: writer.writeEndElement();//c:val or c:yVal andre@1: } andre@1: andre@1: writer.writeEndElement();//c:ser andre@1: } andre@1: andre@1: bool ChartPrivate::loadXmlAxis(QXmlStreamReader &reader) andre@1: { andre@1: Q_ASSERT(reader.name().endsWith(QLatin1String("Ax"))); andre@1: QString name = reader.name().toString(); andre@1: andre@1: XlsxAxis *axis = new XlsxAxis; andre@1: if (name == QLatin1String("valAx")) andre@1: axis->type = XlsxAxis::T_Val; andre@1: else if (name == QLatin1String("catAx")) andre@1: axis->type = XlsxAxis::T_Cat; andre@1: else if (name == QLatin1String("serAx")) andre@1: axis->type = XlsxAxis::T_Ser; andre@1: else andre@1: axis->type = XlsxAxis::T_Date; andre@1: andre@1: axisList.append(QSharedPointer(axis)); andre@1: andre@1: while (!reader.atEnd()) { andre@1: reader.readNextStartElement(); andre@1: if (reader.tokenType() == QXmlStreamReader::StartElement) { andre@1: if (reader.name() == QLatin1String("axPos")) { andre@1: QXmlStreamAttributes attrs = reader.attributes(); andre@1: QStringRef pos = attrs.value(QLatin1String("val")); andre@1: if (pos==QLatin1String("l")) andre@1: axis->axisPos = XlsxAxis::Left; andre@1: else if (pos==QLatin1String("r")) andre@1: axis->axisPos = XlsxAxis::Right; andre@1: else if (pos==QLatin1String("b")) andre@1: axis->axisPos = XlsxAxis::Bottom; andre@1: else andre@1: axis->axisPos = XlsxAxis::Top; andre@1: } else if (reader.name() == QLatin1String("axId")) { andre@1: axis->axisId = reader.attributes().value(QLatin1String("val")).toString().toInt(); andre@1: } else if (reader.name() == QLatin1String("crossAx")) { andre@1: axis->crossAx = reader.attributes().value(QLatin1String("val")).toString().toInt(); andre@1: } andre@1: } else if (reader.tokenType() == QXmlStreamReader::EndElement andre@1: && reader.name() == name) { andre@1: break; andre@1: } andre@1: } andre@1: andre@1: return true; andre@1: } andre@1: andre@1: void ChartPrivate::saveXmlAxes(QXmlStreamWriter &writer) const andre@1: { andre@1: for (int i=0; itype) { andre@1: case XlsxAxis::T_Cat: name = QStringLiteral("c:catAx"); break; andre@1: case XlsxAxis::T_Val: name = QStringLiteral("c:valAx"); break; andre@1: case XlsxAxis::T_Ser: name = QStringLiteral("c:serAx"); break; andre@1: case XlsxAxis::T_Date: name = QStringLiteral("c:dateAx"); break; andre@1: default: break; andre@1: } andre@1: andre@1: QString pos; andre@1: switch (axis->axisPos) { andre@1: case XlsxAxis::Top: pos = QStringLiteral("t"); break; andre@1: case XlsxAxis::Bottom: pos = QStringLiteral("b"); break; andre@1: case XlsxAxis::Left: pos = QStringLiteral("l"); break; andre@1: case XlsxAxis::Right: pos = QStringLiteral("r"); break; andre@1: default: break; andre@1: } andre@1: andre@1: writer.writeStartElement(name); andre@1: writer.writeEmptyElement(QStringLiteral("c:axId")); andre@1: writer.writeAttribute(QStringLiteral("val"), QString::number(axis->axisId)); andre@1: andre@1: writer.writeStartElement(QStringLiteral("c:scaling")); andre@1: writer.writeEmptyElement(QStringLiteral("c:orientation")); andre@1: writer.writeAttribute(QStringLiteral("val"), QStringLiteral("minMax")); andre@1: writer.writeEndElement();//c:scaling andre@1: andre@1: writer.writeEmptyElement(QStringLiteral("c:axPos")); andre@1: writer.writeAttribute(QStringLiteral("val"), pos); andre@1: andre@1: writer.writeEmptyElement(QStringLiteral("c:crossAx")); andre@1: writer.writeAttribute(QStringLiteral("val"), QString::number(axis->crossAx)); andre@1: andre@1: writer.writeEndElement();//name andre@1: } andre@1: } andre@1: andre@1: QT_END_NAMESPACE_XLSX