Add slicerCache Pivot table part to xlsb writing

This commit is contained in:
Viktor Andreev
2024-09-27 17:37:27 +06:00
parent bb41c8b85f
commit bdb902128d
4 changed files with 45 additions and 0 deletions

View File

@ -48,6 +48,7 @@
#include "../../XlsxFormat/Worksheets/WorksheetChildOther.h"
#include "../../XlsxFormat/Timelines/Timeline.h"
#include "../../XlsxFormat/Workbook/Metadata.h"
#include "../../XlsxFormat/Workbook/Workbook.h"
#include "../Comments.h"
@ -231,6 +232,7 @@ namespace OOX
*m_sUri == L"{9260A510-F301-46a8-8635-F512D64BE5F5}" ||
*m_sUri == L"{3e2802c4-a4d2-4d8b-9148-e3be6c30e623}" ||
*m_sUri == L"{bdbb8cdc-fa1e-496e-a857-3c3f30c029c3}" ||
*m_sUri == L"{876F7934-8845-4945-9796-88D515C7AA90}" ||
*m_sUri == L"http://schemas.microsoft.com/office/drawing/2008/diagram"))
{
int nCurDepth = oReader.GetDepth();
@ -383,6 +385,10 @@ namespace OOX
{
m_oRichValueBlock = oReader;
}
else if (sName == L"pivotCaches")
{
m_oWorkbookPivotCaches = oReader;
}
}
}
else
@ -737,6 +743,12 @@ namespace OOX
{
ptr->m_SLICERCACHEIDS = i->m_oSlicerCaches->toBin();
}
else if(i->m_sUri == L"{876F7934-8845-4945-9796-88D515C7AA90}")
{
if(i->m_oWorkbookPivotCaches.IsInit())
ptr->m_SLICERCACHESPIVOTCACHEIDS = i->m_oWorkbookPivotCaches->toBin14();
}
}
return objectPtr;
}

View File

@ -62,6 +62,7 @@ namespace OOX
class CTimelineStyles;
class CDynamicArrayProperties;
class CRichValueBlock;
class CWorkbookPivotCaches;
}
namespace Drawing
@ -155,6 +156,7 @@ namespace OOX
nullable<OOX::Spreadsheet::CTimelineStyles> m_oTimelineStyles;
nullable<OOX::Spreadsheet::CPivotCacheDefinitionExt> m_oPivotCacheDefinitionExt;
nullable<OOX::Spreadsheet::CWorkbookPivotCaches> m_oWorkbookPivotCaches;
std::vector<OOX::Spreadsheet::CSlicerCachePivotTable*> m_oSlicerCachePivotTables;
nullable<OOX::Spreadsheet::CTableSlicerCache> m_oTableSlicerCache;

View File

@ -43,12 +43,15 @@
#include "../../XlsbFormat/Biff12_unions/EXTERNALS.h"
#include "../../XlsbFormat/Biff12_unions/PIVOTCACHEIDS.h"
#include "../../XlsbFormat/Biff12_unions/PIVOTCACHEID.h"
#include "../../XlsbFormat/Biff12_unions/SLICERCACHESPIVOTCACHEIDS.h"
#include "../../XlsbFormat/Biff12_unions/SLICERCACHESPIVOTCACHEID.h"
#include "../../XlsbFormat/Biff12_records/FileVersion.h"
#include "../../XlsbFormat/Biff12_records/BeginPivotCacheID.h"
#include "../../XlsbFormat/Biff12_unions/SUP.h"
#include "../../XlsbFormat/Biff12_records/SupSelf.h"
#include "../../XlsbFormat/Biff12_records/CommonRecords.h"
#include "../../XlsbFormat/Biff12_records/BundleSh.h"
#include "../../XlsbFormat/Biff12_records/BeginSlicerCachesPivotCacheID.h"
#include "../../../MsBinaryFile/XlsFile/Format/Logic/GlobalWorkbookInfo.h"
@ -111,6 +114,22 @@ namespace OOX
ptr1->irstcacheRelID.value.setSize(0xFFFFFFFF);
return objectPtr;
}
XLS::BaseObjectPtr CWorkbookPivotCache::toBin14()
{
auto ptr(new XLSB::SLICERCACHESPIVOTCACHEID);
XLS::BaseObjectPtr objectPtr(ptr);
auto ptr1(new XLSB::BeginSlicerCachesPivotCacheID);
ptr->m_BrtBeginSlicerCachesPivotCacheID = XLS::BaseObjectPtr{ptr1};
if(m_oRid.IsInit())
{
ptr1->FRTheader.relID.relId = m_oRid->GetValue();
ptr1->FRTheader.fRelID = true;
}
else
ptr1->FRTheader.relID.relId.setSize(0xFFFFFFFF);
return objectPtr;
}
EElementType CWorkbookPivotCache::getType() const
{
return et_x_WorkbookPivotCache;
@ -202,6 +221,16 @@ namespace OOX
return objectPtr;
}
XLS::BaseObjectPtr CWorkbookPivotCaches::toBin14()
{
auto ptr(new XLSB::SLICERCACHESPIVOTCACHEIDS);
XLS::BaseObjectPtr objectPtr(ptr);
for(auto i:m_arrItems)
ptr->m_arSLICERCACHESPIVOTCACHEID.push_back(i->toBin14());
return objectPtr;
}
EElementType CWorkbookPivotCaches::getType() const
{
return et_x_WorkbookPivotCaches;

View File

@ -82,6 +82,7 @@ namespace OOX
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
XLS::BaseObjectPtr toBin();
XLS::BaseObjectPtr toBin14();
void fromBin(XLS::BaseObjectPtr& obj);
virtual EElementType getType() const;
@ -108,6 +109,7 @@ namespace OOX
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
XLS::BaseObjectPtr toBin();
XLS::BaseObjectPtr toBin14();
void fromBin(XLS::BaseObjectPtr& obj);
virtual EElementType getType() const;
};