add radar chart conversion

This commit is contained in:
Viktor Andreev
2026-01-28 17:44:31 +06:00
parent 68f2f0760d
commit 0e48e65ef1
3 changed files with 85 additions and 0 deletions

View File

@ -55,6 +55,7 @@
#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/Area.h"
#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/Surf.h"
#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/Scatter.h"
#include "../../../MsBinaryFile/XlsFile/Format/Logic/Biff_records/Radar.h"
namespace OOX
{
@ -7627,6 +7628,64 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\"");
writer.WriteString(sNodeName);
writer.WriteString(L">");
}
XLS::BaseObjectPtr CT_RadarSer::GetXLSFormat(const _UINT32 chartIndex)const
{
auto seriesFormat = new XLS::SERIESFORMAT;
{
auto ai1 = new XLS::BRAI;
seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai1));
}
auto series = new XLS::Series;
series->sdtX = 1;
if(m_val != nullptr && m_val->m_numRef != nullptr)
{
if(m_val->m_numRef->m_numCache != nullptr)
{
series->cValx = m_val->m_numRef->m_numCache->m_pt.size();
series->cValy = m_val->m_numRef->m_numCache->m_pt.size();
}
{
auto ai2 = new XLS::BRAI;
ai2->id = 1;
if(m_val->m_numRef->m_f.IsInit())
{
ai2->rt = 2;
ai2->formula.parseStringFormula(m_val->m_numRef->m_f.get(), L"");
}
seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai2));
auto ai3 = new XLS::BRAI;
ai3->id = 2;
auto ai4 = new XLS::BRAI;
ai4->id = 3;
seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai3));
seriesFormat->m_arAI.push_back(XLS::BaseObjectPtr(ai4));
}
}
auto SeriesStyle = new XLS::SS;
seriesFormat->m_arPtSS.push_back(XLS::BaseObjectPtr(SeriesStyle));
{
auto dataFormat = new XLS::DataFormat;
SeriesStyle->m_DataFormat = XLS::BaseObjectPtr(dataFormat);
if(m_order.IsInit())
dataFormat->iss = m_order.get();
if(m_idx.IsInit())
dataFormat->yi = m_idx.get();
}
if(m_spPr.IsInit())
{
if(m_spPr->ln.IsInit())
SeriesStyle->m_LineFormat = m_spPr->ln->toXLS();
if(m_spPr->Fill.is_init())
SeriesStyle->m_AreaFormat = m_spPr->Fill.toXLS();
}
seriesFormat->m_Series = XLS::BaseObjectPtr(series);
auto ser2Crt = new XLS::SerToCrt;
ser2Crt->id = chartIndex;
seriesFormat->m_SerToCrt = XLS::BaseObjectPtr(ser2Crt);
return XLS::BaseObjectPtr(seriesFormat);
}
EElementType CT_RadarSer::getType() { return et_ct_radarser; }
ST_RadarStyle CRadarStyle::FromString(const std::wstring &sValue)
@ -7726,6 +7785,25 @@ xmlns:c16r2=\"http://schemas.microsoft.com/office/drawing/2015/06/chart\"");
writer.WriteString(sNodeName);
writer.WriteString(L">");
}
XLS::BaseObjectPtr CT_RadarChart::toXLS(const unsigned short chartIndex, XLS::BaseObjectPtr ChartFormats)
{
auto ChartFormatsPtr = static_cast<XLS::CHARTFORMATS*>(ChartFormats.get());
for(auto ser : m_ser)
{
if(ser != nullptr)
{
ChartFormatsPtr->m_arSERIESFORMAT.push_back(ser->GetXLSFormat(chartIndex));
}
}
auto ptr = new XLS::CRT;
auto chartFormat = new XLS::ChartFormat;
chartFormat->icrt = chartIndex;
ptr->m_ChartFormat = XLS::BaseObjectPtr(chartFormat);
auto chartType = new XLS::Radar;
ptr->m_ChartType = XLS::BaseObjectPtr(chartType);
return XLS::BaseObjectPtr(ptr);
}
EElementType CT_RadarChart::getType() { return et_ct_radarchart; }
CT_StockChart::CT_StockChart()
{

View File

@ -1729,6 +1729,7 @@ namespace OOX
{}
void fromXML(XmlUtils::CXmlLiteReader& oReader);
void toXML(const std::wstring& sNodeName, NSStringUtils::CStringBuilder& writer) const;
XLS::BaseObjectPtr GetXLSFormat(const _UINT32 chartIndex)const;
EElementType getType();
};
class CT_RadarChart
@ -1746,6 +1747,7 @@ namespace OOX
~CT_RadarChart();
void fromXML(XmlUtils::CXmlLiteReader& oReader);
void toXML(const std::wstring& sNodeName, NSStringUtils::CStringBuilder& writer) const;
XLS::BaseObjectPtr toXLS(const unsigned short chartIndex, XLS::BaseObjectPtr ChartFormatsPtr);
EElementType getType();
};
class CT_UpDownBar

View File

@ -369,6 +369,11 @@ namespace OOX
auto ScatterChart = static_cast<CT_ScatterChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
AxisParentUnion->m_arCRT.push_back(ScatterChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
}
else if(*ChartFile->m_oChartSpace.m_chart->m_plotArea->m_ItemsElementName0.at(chartIndex) == OOX::Spreadsheet::itemschoicetype5RADARCHART)
{
auto ScatterChart = static_cast<CT_RadarChart*>(ChartFile->m_oChartSpace.m_chart->m_plotArea->m_Items.at(chartIndex));
AxisParentUnion->m_arCRT.push_back(ScatterChart->toXLS(chartIndex, ptr->m_CHARTFORMATS));
}
}
}
if(ChartFile->m_oChartSpace.m_chart->m_title != nullptr && ChartFile->m_oChartSpace.m_chart->m_title->m_tx != nullptr)