Commit 245f989a authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat...

parent 429729b9
......@@ -57,8 +57,8 @@ void SXVI::readFields(CFRecord& record)
fHidden = GETBIT(flags, 0);
fHideDetail = GETBIT(flags, 1);
fFormula = GETBIT(flags, 4);
fMissing = GETBIT(flags, 5);
fFormula = GETBIT(flags, 3);
fMissing = GETBIT(flags, 4);
if (cchName > 0 && cchName < 0xFFFF)
{
......@@ -67,6 +67,43 @@ void SXVI::readFields(CFRecord& record)
}
}
int SXVI::serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"item")
{
if (itmType == 0)
{
CP_XML_ATTR(L"x", iCache);
}
if (fMissing)
CP_XML_ATTR(L"m", 1);
if (fHidden)
CP_XML_ATTR(L"h", 1);
if (fHideDetail)
CP_XML_ATTR(L"h", 1);
if (fFormula)
CP_XML_ATTR(L"f", 1);
switch(itmType)
{
case 0x0001: CP_XML_ATTR(L"t", L"default"); break;
case 0x0002: CP_XML_ATTR(L"t", L"sum"); break;
case 0x0003: CP_XML_ATTR(L"t", L"countA"); break;
case 0x0004: CP_XML_ATTR(L"t", L"avg"); break;
case 0x0005: CP_XML_ATTR(L"t", L"max"); break;
case 0x0006: CP_XML_ATTR(L"t", L"min"); break;
case 0x0007: CP_XML_ATTR(L"t", L"product"); break;
case 0x0008: CP_XML_ATTR(L"t", L"count"); break;
case 0x0009: CP_XML_ATTR(L"t", L"stdDev"); break;
case 0x000a: CP_XML_ATTR(L"t", L"stdDevP"); break;
case 0x000b: CP_XML_ATTR(L"t", L"var"); break;
case 0x000c: CP_XML_ATTR(L"t", L"varP"); break;
}
}
}
return 0;
}
} // namespace XLS
......@@ -48,6 +48,8 @@ public:
void readFields(CFRecord& record);
int serialize(std::wostream & strm);
static const ElementType type = typeSXVI;
unsigned short itmType; //enum
......
......@@ -51,7 +51,6 @@ public:
static const ElementType type = typeSxIvd;
std::vector<short> rgSxivd;
};
} // namespace XLS
......
......@@ -45,7 +45,6 @@ Sxvd::~Sxvd()
{
}
BaseObjectPtr Sxvd::clone()
{
return BaseObjectPtr(new Sxvd(*this));
......
......@@ -31,13 +31,12 @@
*/
#include "PIVOTIVD.h"
#include <Logic/Biff_records/SxIvd.h>
#include <Logic/Biff_records/Continue.h>
#include "../Biff_records/SxIvd.h"
#include "../Biff_records/Continue.h"
namespace XLS
{
PIVOTIVD::PIVOTIVD()
{
}
......@@ -53,7 +52,6 @@ BaseObjectPtr PIVOTIVD::clone()
return BaseObjectPtr(new PIVOTIVD(*this));
}
// PIVOTIVD = SxIvd *Continue
const bool PIVOTIVD::loadContent(BinProcessor& proc)
{
......@@ -68,6 +66,21 @@ const bool PIVOTIVD::loadContent(BinProcessor& proc)
return true;
}
int PIVOTIVD::serialize(std::wostream & strm)
{
SxIvd* vd = dynamic_cast<SxIvd*>(m_SxIvd.get());
CP_XML_WRITER(strm)
{
for (size_t i = 0; i < vd->rgSxivd.size(); i++)
{
CP_XML_NODE(L"field")
{
CP_XML_ATTR(L"x", vd->rgSxivd[i]);
}
}
}
return 0;
}
} // namespace XLS
......@@ -47,6 +47,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & strm);
static const ElementType type = typePIVOTIVD;
BaseObjectPtr m_SxIvd;
......
......@@ -31,30 +31,26 @@
*/
#include "PIVOTVD.h"
#include <Logic/Biff_records/Sxvd.h>
#include <Logic/Biff_records/SXVI.h>
#include <Logic/Biff_records/SXVDEx.h>
#include "../Biff_records/Sxvd.h"
#include "../Biff_records/SXVI.h"
#include "../Biff_records/SXVDEx.h"
namespace XLS
{
PIVOTVD::PIVOTVD()
{
}
PIVOTVD::~PIVOTVD()
{
}
BaseObjectPtr PIVOTVD::clone()
{
return BaseObjectPtr(new PIVOTVD(*this));
}
// PIVOTVD = Sxvd *SXVI SXVDEx
const bool PIVOTVD::loadContent(BinProcessor& proc)
{
......@@ -79,6 +75,39 @@ const bool PIVOTVD::loadContent(BinProcessor& proc)
return true;
}
int PIVOTVD::serialize(std::wostream & strm)
{
Sxvd* vd = dynamic_cast<Sxvd*>(m_Sxvd.get());
SXVDEx* vd_ex = dynamic_cast<SXVDEx*>(m_SXVDEx.get());
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"pivotField")
{
//CP_XML_ATTR(L"axis", );
//CP_XML_ATTR(L"compact", );
//CP_XML_ATTR(L"outline", );
//CP_XML_ATTR(L"subtotalTop", );
//CP_XML_ATTR(L"showAll", );
//CP_XML_ATTR(L"includeNewItemsInFilter", );
//CP_XML_ATTR(L"sortType", );
//CP_XML_ATTR(L"rankBy", );
//CP_XML_ATTR(L"axis", );
if (!m_arSXVI.empty())
{
CP_XML_NODE(L"items")
{
CP_XML_ATTR(L"count", m_arSXVI.size());
for (size_t i = 0; i < m_arSXVI.size(); i++)
{
m_arSXVI[i]->serialize(CP_XML_STREAM());
}
}
}
}
}
return 0;
}
} // namespace XLS
......@@ -49,6 +49,8 @@ public:
static const ElementType type = typePIVOTVD;
int serialize(std::wostream & strm);
BaseObjectPtr m_Sxvd;
std::vector<BaseObjectPtr> m_arSXVI;
BaseObjectPtr m_SXVDEx;
......
......@@ -33,7 +33,13 @@
#include "PIVOTVIEW.h"
#include "PIVOTCORE.h"
#include "PIVOTFRT.h"
#include "PIVOTVD.h"
#include "PIVOTIVD.h"
#include "PIVOTPI.h"
#include "PIVOTLI.h"
#include "PIVOTEX.h"
#include "../Biff_records/SXDI.h"
#include "../Biff_records/SxView.h"
namespace XLS
......@@ -90,13 +96,10 @@ int PIVOTVIEW::serialize(std::wostream & strm)
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
CP_XML_ATTR(L"cacheId", view->iCache);
CP_XML_ATTR(L"name", view->stTable.value());
CP_XML_ATTR(L"dataCaption", view->stData.value());
CP_XML_ATTR(L"cacheId", view->iCache);
CP_XML_ATTR(L"useAutoFormatting", view->fAutoFormat);
CP_XML_ATTR(L"dataOnRows", view->sxaxis4Data.bRw);
CP_XML_ATTR(L"autoFormatId", view->itblAutoFmt);
CP_XML_ATTR(L"applyNumberFormats", view->fAtrNum);
CP_XML_ATTR(L"applyBorderFormats", view->fAtrBdr);
......@@ -104,6 +107,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
CP_XML_ATTR(L"applyPatternFormats", view->fAtrPat);
CP_XML_ATTR(L"applyAlignmentFormats", view->fAtrAlc);
CP_XML_ATTR(L"applyWidthHeightFormats", view->fAtrProc);
CP_XML_ATTR(L"dataCaption", view->stData.value());
//updatedVersion="2"
//asteriskTotals="1"
//showMemberPropertyTips="0"
......@@ -124,31 +128,65 @@ int PIVOTVIEW::serialize(std::wostream & strm)
}
CP_XML_NODE(L"pivotFields")
{
CP_XML_ATTR(L"count", view->cDim);
CP_XML_ATTR(L"count", view->cDim);//Sxvd
for (size_t i = 0; i < core->m_arPIVOTVD.size(); i++)
{
core->m_arPIVOTVD[i]->serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"rowFields")
if (core->m_arPIVOTIVD.size() == 2)//0 or 2
{
CP_XML_ATTR(L"count", view->cDimRw);
CP_XML_NODE(L"rowFields")
{
CP_XML_ATTR(L"count", view->cDimRw);
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[0].get());
ivd->serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"rowItems")
{
CP_XML_ATTR(L"count", view->cRw);
//for (size_t i = 0; i < m_arPIVOTLI.size(); i++)
//{
// PIVOTLI* line = dynamic_cast<PIVOTLI*>(m_arPIVOTLI[i].get());
// m_arPIVOTIVD[i]->serialize(CP_XML_STREAM());
//}
}
CP_XML_NODE(L"colFields")
if (core->m_arPIVOTIVD.size() == 2)//0 or 2
{
CP_XML_ATTR(L"count", view->cDimCol);
CP_XML_NODE(L"colFields")
{
CP_XML_ATTR(L"count", view->cDimCol);
PIVOTIVD* ivd = dynamic_cast<PIVOTIVD*>(core->m_arPIVOTIVD[1].get());
ivd->serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"colItems")
{
CP_XML_ATTR(L"count", view->cCol);
//for (size_t i = 0; i < m_arPIVOTLI.size(); i++)
//{
// m_arPIVOTIVD[i]->serialize(CP_XML_STREAM());
//}
}
CP_XML_NODE(L"pageFields")
if (core->m_PIVOTPI)
{
CP_XML_ATTR(L"count", view->cDimPg);
CP_XML_NODE(L"pageFields")
{
CP_XML_ATTR(L"count", view->cDimPg);
core->m_PIVOTPI->serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"dataFields")
{
CP_XML_ATTR(L"count", view->cDimData);
for (size_t i = 0; i < core->m_arSXDI.size(); i++)
{
core->m_arSXDI[i]->serialize(CP_XML_STREAM());
}
}
//CP_XML_NODE(L"pivotTableStyleInfo")
//{
......
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