From 404748ec5a949db247194e90254f280ed8335ada Mon Sep 17 00:00:00 2001 From: Viktor Andreev Date: Mon, 9 Feb 2026 14:46:19 +0600 Subject: [PATCH] fix axis conversion --- OOXML/XlsxFormat/Drawing/XlsxDrawing.cpp | 34 ++++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/OOXML/XlsxFormat/Drawing/XlsxDrawing.cpp b/OOXML/XlsxFormat/Drawing/XlsxDrawing.cpp index d2791f0605..e137827292 100644 --- a/OOXML/XlsxFormat/Drawing/XlsxDrawing.cpp +++ b/OOXML/XlsxFormat/Drawing/XlsxDrawing.cpp @@ -413,25 +413,31 @@ namespace OOX } if(ChartFormatsPtr->m_arAXISPARENT.size() < 2) - { - if(catAxId != -1 && !ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.empty()) + { for(auto axPose = 0; axPose < ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName1.size(); axPose++) { - auto ivAx = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(0)); - if(ivAx->m_axId.IsInit() && ivAx->m_axId.get() == catAxId) + if(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName1[axPose] != nullptr && ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.size() > axPose) { - axes->m_arAxes.push_back(ivAx->toXLS()); - } - } - if(valAxId != -1 && !ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.empty()) - { - auto dvAx = static_cast(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items1.at(1)); - if(dvAx->m_axId.IsInit() && dvAx->m_axId.get() == valAxId) - { - axes->m_arAxes.push_back(dvAx->toXLS()); + auto AxType = *ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName1[axPose]; + switch (AxType) + { + 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: + break; + } } } } - if(ChartFile->m_oChartSpace.m_chart->m_legend != nullptr && !AxisParentUnion->m_arCRT.empty()) { auto crtPtr = static_cast(AxisParentUnion->m_arCRT.back().get());