Commit 4326a7d2 authored by Sergey Konovalov's avatar Sergey Konovalov

fix bug 34695

parent 2dcef226
......@@ -47,13 +47,11 @@ namespace Writers
};
std::vector<ChartElem*> m_aCharts;
ContentTypesWriter& m_oContentTypesWriter;
int nChartCount;
public:
std::wstring m_sDir;
public:
ChartWriter(std::wstring sDir, ContentTypesWriter& oContentTypesWriter):m_sDir(sDir),m_oContentTypesWriter(oContentTypesWriter)
{
nChartCount = 0;
}
~ChartWriter()
{
......@@ -91,28 +89,18 @@ namespace Writers
}
}
}
void AddChart(std::wstring& content, std::wstring& sRelsName, std::wstring& sFileName, int& index)
void AddChart(std::wstring& content, std::wstring& sRelsName, std::wstring& sFileName, int index)
{
ChartElem* pChartElem = new ChartElem();
pChartElem->content = content;
pChartElem->index = nChartCount + 1;
nChartCount++;
pChartElem->index = index;
pChartElem->filename = L"chart" + std::to_wstring(pChartElem->index) + L".xml";
sRelsName = L"charts/" + pChartElem->filename;
sFileName = pChartElem->filename;
index = pChartElem->index;
m_aCharts.push_back(pChartElem);
}
int getChartCount()
{
return nChartCount;
}
void setChartCount(int val)
{
nChartCount = val;
}
};
}
#endif // #ifndef CHART_WRITER
......@@ -6287,15 +6287,11 @@ public:
std::wstring sDrawingProperty = oCDrawingProperty.Write();
if(false == sDrawingProperty.empty())
{
m_oFileWriter.m_pDrawingConverter->SetDocumentChartsCount(m_oFileWriter.m_oChartWriter.getChartCount());
long nCurPos = m_oBufferedStream.GetPos();
std::wstring sDrawingXml;
m_oFileWriter.m_pDrawingConverter->SaveObjectEx(oCDrawingProperty.DataPos, oCDrawingProperty.DataLength, sDrawingProperty, XMLWRITER_DOC_TYPE_DOCX, sDrawingXml);
m_oBufferedStream.Seek(nCurPos);
m_oFileWriter.m_oChartWriter.setChartCount(m_oFileWriter.m_pDrawingConverter->GetDocumentChartsCount());
if( false == sDrawingXml.empty())
{
GetRunStringWriter().WriteString(sDrawingXml);
......@@ -6606,7 +6602,10 @@ public:
oBinaryChartReader.ReadCT_ChartSpace(length, &pChartSpace->m_oChartSpace);
//save xlsx
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(m_oFileWriter.m_oChartWriter.getChartCount() + 1) + L".xlsx";
_INT32 nChartCount = m_oFileWriter.m_pDrawingConverter->GetDocumentChartsCount();
_INT32 nChartIndex = nChartCount + 1;
m_oFileWriter.m_pDrawingConverter->SetDocumentChartsCount(nChartCount + 1);
std::wstring sXlsxFilename = L"Microsoft_Excel_Worksheet" + std::to_wstring(nChartIndex) + L".xlsx";
std::wstring sXlsxPath = pathChartsWorksheetDir.GetPath() + FILE_SEPARATOR_STR + sXlsxFilename;
BinXlsxRW::CXlsxSerializer oXlsxSerializer;
oXlsxSerializer.writeChartXlsx(sXlsxPath, *pChartSpace);
......@@ -6629,7 +6628,6 @@ public:
std::wstring sFilename;
std::wstring sRelsName;
int nChartIndex;
std::wstring sContent = sw.GetData();
m_oFileWriter.m_oChartWriter.AddChart(sContent, sRelsName, sFilename, nChartIndex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment