diff --git a/OOXML/XlsxFormat/Chart/ChartSerialize.cpp b/OOXML/XlsxFormat/Chart/ChartSerialize.cpp index 2ccdfaa049..f903a06fcc 100644 --- a/OOXML/XlsxFormat/Chart/ChartSerialize.cpp +++ b/OOXML/XlsxFormat/Chart/ChartSerialize.cpp @@ -3018,6 +3018,17 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\""); lnFmt.lineFormat = m_majorGridlines->m_spPr->ln->toXLS(); axs->m_AxisLine_Format.push_back(lnFmt); } + if(m_minorGridlines != nullptr) + { + auto axisline = new XLS::AxisLine; + axisline->id = 2; + XLS::AXS::_axis_line_format lnFmt; + lnFmt.axisLine = XLS::BaseObjectPtr(axisline); + + if(m_minorGridlines->m_spPr.IsInit() && m_minorGridlines->m_spPr->ln.IsInit()) + lnFmt.lineFormat = m_minorGridlines->m_spPr->ln->toXLS(); + axs->m_AxisLine_Format.push_back(lnFmt); + } auto tickPtr = new XLS::Tick; axs->m_Tick = XLS::BaseObjectPtr(tickPtr); if(m_tickLblPos.IsInit()) @@ -3276,7 +3287,10 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\""); auto axis = new XLS::Axis; auto axs = new XLS::AXS; dvAxis->m_AXS = XLS::BaseObjectPtr(axs); - axis->wType = 1; + if(m_axPos.IsInit() && m_axPos->GetValue() == OOX::Spreadsheet::ST_AxPos::st_axposL) + axis->wType = 0; + else + axis->wType = 1; dvAxis->m_Axis = XLS::BaseObjectPtr(axis); auto valSerRange = new XLS::ValueRange; valSerRange->fAutoMin = true; @@ -3312,6 +3326,17 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\""); lnFmt.lineFormat = m_majorGridlines->m_spPr->ln->toXLS(); axs->m_AxisLine_Format.push_back(lnFmt); } + if(m_minorGridlines != nullptr) + { + auto axisline = new XLS::AxisLine; + axisline->id = 2; + XLS::AXS::_axis_line_format lnFmt; + lnFmt.axisLine = XLS::BaseObjectPtr(axisline); + + if(m_minorGridlines->m_spPr.IsInit() && m_minorGridlines->m_spPr->ln.IsInit()) + lnFmt.lineFormat = m_minorGridlines->m_spPr->ln->toXLS(); + axs->m_AxisLine_Format.push_back(lnFmt); + } auto tickPtr = new XLS::Tick; axs->m_Tick = XLS::BaseObjectPtr(tickPtr); if(m_tickLblPos.IsInit()) @@ -7565,7 +7590,7 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\""); series->cValy = m_yVal->m_numRef->m_numCache->m_pt.size(); { auto ai2 = new XLS::BRAI; - ai2->id = 1; + ai2->id = 2; if(m_xVal->m_numRef->m_f.IsInit()) { ai2->rt = 2; @@ -7573,7 +7598,12 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\""); } seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai2)); auto ai3 = new XLS::BRAI; - ai3->id = 2; + ai3->id = 1; + if(m_yVal->m_numRef->m_f.IsInit()) + { + ai3->rt = 2; + ai3->formula.parseStringFormula(m_yVal->m_numRef->m_f.get(), L""); + } auto ai4 = new XLS::BRAI; ai4->id = 3; seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai3)); diff --git a/OOXML/XlsxFormat/Drawing/XlsxDrawing.cpp b/OOXML/XlsxFormat/Drawing/XlsxDrawing.cpp index e137827292..5c1fbeb926 100644 --- a/OOXML/XlsxFormat/Drawing/XlsxDrawing.cpp +++ b/OOXML/XlsxFormat/Drawing/XlsxDrawing.cpp @@ -308,8 +308,6 @@ namespace OOX auto AxisParentUnion = new XLS::AXISPARENT; auto axes = new XLS::AXES; AxisParentUnion->m_AXES = XLS::BaseObjectPtr(axes); - _INT32 catAxId = -1; - _INT32 valAxId = -1; ChartFormatsPtr->m_arAXISPARENT.push_back(XLS::BaseObjectPtr(AxisParentUnion)); auto axisPos = new XLS::Pos; axisPos->x1 = -1000; @@ -324,19 +322,11 @@ namespace OOX { auto barChart = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex)); AxisParentUnion->m_arCRT.push_back(barChart->toXLS(chartIndex, ptr->m_CHARTFORMATS)); - if(barChart->m_axId.size() > 0) - catAxId = barChart->m_axId.at(0); - if(barChart->m_axId.size() > 1) - valAxId = barChart->m_axId.at(1); } else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5BAR3DCHART) { auto barChart = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex)); AxisParentUnion->m_arCRT.push_back(barChart->toXLS(chartIndex, ptr->m_CHARTFORMATS)); - if(barChart->m_axId.size() > 0) - catAxId = barChart->m_axId.at(0); - if(barChart->m_axId.size() > 1) - valAxId = barChart->m_axId.at(1); } else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5PIECHART) { @@ -352,91 +342,64 @@ namespace OOX { auto LineChart = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex)); AxisParentUnion->m_arCRT.push_back(LineChart->toXLS(chartIndex, ptr->m_CHARTFORMATS)); - if(LineChart->m_axId.size() > 0) - catAxId = LineChart->m_axId.at(0); - if(LineChart->m_axId.size() > 1) - valAxId = LineChart->m_axId.at(1); } else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5LINE3DCHART) { auto LineChart = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex)); AxisParentUnion->m_arCRT.push_back(LineChart->toXLS(chartIndex, ptr->m_CHARTFORMATS)); - if(LineChart->m_axId.size() > 0) - catAxId = LineChart->m_axId.at(0); - if(LineChart->m_axId.size() > 1) - valAxId = LineChart->m_axId.at(1); } else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5AREACHART) { auto AreaChart = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex)); AxisParentUnion->m_arCRT.push_back(AreaChart->toXLS(chartIndex, ptr->m_CHARTFORMATS)); - if(AreaChart->m_axId.size() > 0) - catAxId = AreaChart->m_axId.at(0); - if(AreaChart->m_axId.size() > 1) - valAxId = AreaChart->m_axId.at(1); } else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5AREA3DCHART) { auto AreaChart = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex)); AxisParentUnion->m_arCRT.push_back(AreaChart->toXLS(chartIndex, ptr->m_CHARTFORMATS)); - if(AreaChart->m_axId.size() > 0) - catAxId = AreaChart->m_axId.at(0); - if(AreaChart->m_axId.size() > 1) - valAxId = AreaChart->m_axId.at(1); } else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5SURFACECHART) { auto SurfaceChart = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex)); AxisParentUnion->m_arCRT.push_back(SurfaceChart->toXLS(chartIndex, ptr->m_CHARTFORMATS)); - if(SurfaceChart->m_axId.size() > 0) - catAxId = SurfaceChart->m_axId.at(0); - if(SurfaceChart->m_axId.size() > 1) - valAxId = SurfaceChart->m_axId.at(1); } else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5SCATTERCHART) { auto ScatterChart = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex)); AxisParentUnion->m_arCRT.push_back(ScatterChart->toXLS(chartIndex, ptr->m_CHARTFORMATS)); - if(ScatterChart->m_axId.size() > 0) - catAxId = ScatterChart->m_axId.at(0); - if(ScatterChart->m_axId.size() > 1) - valAxId = ScatterChart->m_axId.at(1); } else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5RADARCHART) { auto ScatterChart = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex)); AxisParentUnion->m_arCRT.push_back(ScatterChart->toXLS(chartIndex, ptr->m_CHARTFORMATS)); - if(ScatterChart->m_axId.size() > 0) - catAxId = ScatterChart->m_axId.at(0); - if(ScatterChart->m_axId.size() > 1) - valAxId = ScatterChart->m_axId.at(1); } if(ChartFormatsPtr->m_arAXISPARENT.size() < 2) - { for(auto axPose = 0; axPose < ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName1.size(); axPose++) + { + for(auto axPose = 0; axPose < ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName1.size(); axPose++) + { + if(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName1[axPose] != nullptr && ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.size() > axPose) { - if(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName1[axPose] != nullptr && ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.size() > axPose) + auto AxType = *ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName1[axPose]; + switch (AxType) { - auto AxType = *ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName1[axPose]; - switch (AxType) + case ItemsChoiceType6::itemschoicetype6CATAX: { - case ItemsChoiceType6::itemschoicetype6CATAX: - { - auto ivAx = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(axPose)); - axes->m_arAxes.push_back(ivAx->toXLS()); - break; - } - case ItemsChoiceType6::itemschoicetype6VALAX: - { - auto dvAx = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(1)); - axes->m_arAxes.push_back(dvAx->toXLS()); - break; - } - default: + auto ivAx = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(axPose)); + axes->m_arAxes.push_back(ivAx->toXLS()); break; } + case ItemsChoiceType6::itemschoicetype6VALAX: + { + auto dvAx = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(axPose)); + axes->m_arAxes.push_back(dvAx->toXLS()); + break; + } + default: + break; } } + } } if(ChartFile->m_oChartSpace.m_chart->m_legend != nullptr && !AxisParentUnion->m_arCRT.empty()) { @@ -444,7 +407,6 @@ namespace OOX crtPtr->m_LD = ChartFile->m_oChartSpace.m_chart->m_legend->toXLS(); } } - } if(ChartFile->m_oChartSpace.m_chart->m_title != nullptr && ChartFile->m_oChartSpace.m_chart->m_title->m_tx != nullptr) {