Commit 59d75ed1 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - fix pivots

parent ccc4d751
...@@ -72,14 +72,21 @@ void SXLI::readFields(CFRecord& record) ...@@ -72,14 +72,21 @@ void SXLI::readFields(CFRecord& record)
item.fGrand = GETBIT(flags, 11); item.fGrand = GETBIT(flags, 11);
item.fMultiDataOnAxis = GETBIT(flags, 12); item.fMultiDataOnAxis = GETBIT(flags, 12);
//if (!item.fGrand && item.itmType != 0x000E) if (item.fGrand)
item.isxviMac = 1;
if (item.cSic > item.isxviMac)
item.cSic = item.isxviMac;
if (item.fSbt && item.itmType < 0x000D)
item.isxviMac++;
for (short i = 0; i < item.isxviMac; i++)
{ {
for (short i = 0; i < item.isxviMac; i++) short val; record >> val;
{ item.rgisxvi.push_back(val);
short val; record >> val;
item.rgisxvi.push_back(val);
}
} }
m_arItems.push_back(item); m_arItems.push_back(item);
} }
} }
......
...@@ -57,7 +57,7 @@ public: ...@@ -57,7 +57,7 @@ public:
unsigned char Byte4; unsigned char Byte4;
unsigned short type; unsigned short type;
unsigned short fExprO; unsigned short fExprO;
}; }bytes;
double value; double value;
} data; } data;
}; };
......
...@@ -78,6 +78,7 @@ FDB::FDB() ...@@ -78,6 +78,7 @@ FDB::FDB()
bDate = false; bDate = false;
bNumber = false; bNumber = false;
bEmpty = false; bEmpty = false;
bInteger = false;
} }
FDB::~FDB() FDB::~FDB()
...@@ -164,6 +165,7 @@ const bool FDB::loadContent(BinProcessor& proc) ...@@ -164,6 +165,7 @@ const bool FDB::loadContent(BinProcessor& proc)
bDate |= operatr->bDate; bDate |= operatr->bDate;
bNumber |= operatr->bNumber; bNumber |= operatr->bNumber;
bEmpty |= operatr->bEmpty; bEmpty |= operatr->bEmpty;
bInteger|= operatr->bInteger;
} }
return true; return true;
...@@ -186,7 +188,7 @@ int FDB::serialize(std::wostream & strm) ...@@ -186,7 +188,7 @@ int FDB::serialize(std::wostream & strm)
{ {
CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql); CP_XML_ATTR(L"numFmtId", fdb_type->wTypeSql);
} }
if (m_arSRCSXOPER.empty()) if (m_arSRCSXOPER.empty() && m_arGRPSXOPER.empty() == false)
{ {
CP_XML_ATTR(L"databaseField", 0); CP_XML_ATTR(L"databaseField", 0);
} }
...@@ -234,6 +236,11 @@ int FDB::serialize(std::wostream & strm) ...@@ -234,6 +236,11 @@ int FDB::serialize(std::wostream & strm)
// CP_XML_ATTR(L"containsString", 0); // CP_XML_ATTR(L"containsString", 0);
// } // }
//} //}
if (bInteger)
{
if (bNumber) bInteger = false;
else bNumber = true;
}
if ((bDate & bNumber) || (bNumber & bString)) if ((bDate & bNumber) || (bNumber & bString))
{ {
CP_XML_ATTR(L"containsSemiMixedTypes", 1); CP_XML_ATTR(L"containsSemiMixedTypes", 1);
...@@ -250,6 +257,7 @@ int FDB::serialize(std::wostream & strm) ...@@ -250,6 +257,7 @@ int FDB::serialize(std::wostream & strm)
if (bDate) CP_XML_ATTR(L"containsDate", 1); if (bDate) CP_XML_ATTR(L"containsDate", 1);
if (!bString) CP_XML_ATTR(L"containsString", 0); if (!bString) CP_XML_ATTR(L"containsString", 0);
if (bEmpty) CP_XML_ATTR(L"containsBlank", 1); if (bEmpty) CP_XML_ATTR(L"containsBlank", 1);
if (bInteger) CP_XML_ATTR(L"containsInteger", 1);
if (fdb->fnumMinMaxValid) if (fdb->fnumMinMaxValid)
{ {
......
...@@ -64,6 +64,7 @@ public: ...@@ -64,6 +64,7 @@ public:
bool bDate; bool bDate;
bool bNumber; bool bNumber;
bool bEmpty; bool bEmpty;
bool bInteger;
}; };
......
...@@ -95,7 +95,12 @@ int PIVOTLI::serialize(std::wostream & strm) ...@@ -95,7 +95,12 @@ int PIVOTLI::serialize(std::wostream & strm)
case 0x000E: CP_XML_ATTR(L"t", L"blank"); break; case 0x000E: CP_XML_ATTR(L"t", L"blank"); break;
} }
for (size_t j = 0; j < line_items->m_arItems[i].rgisxvi.size(); j++) if (line_items->m_arItems[i].cSic > 0 && line_items->m_arItems[i].itmType == 0)//??
{
CP_XML_ATTR(L"r", line_items->m_arItems[i].cSic);
}
for (size_t j = line_items->m_arItems[i].cSic; j < line_items->m_arItems[i].rgisxvi.size(); j++)
{ {
CP_XML_NODE(L"x") CP_XML_NODE(L"x")
{ {
......
...@@ -106,7 +106,6 @@ int PIVOTVD::serialize(std::wostream & strm) ...@@ -106,7 +106,6 @@ int PIVOTVD::serialize(std::wostream & strm)
if (vd->fCounta) CP_XML_ATTR(L"countASubtotal", 1); if (vd->fCounta) CP_XML_ATTR(L"countASubtotal", 1);
if (vd->fCount) CP_XML_ATTR(L"countSubtotal", 1); if (vd->fCount) CP_XML_ATTR(L"countSubtotal", 1);
if (vd->fDefault) CP_XML_ATTR(L"defaultSubtotal", 1);
if (vd->fSum) CP_XML_ATTR(L"sumSubtotal", 1); if (vd->fSum) CP_XML_ATTR(L"sumSubtotal", 1);
if (vd->fAverage) CP_XML_ATTR(L"avgSubtotal", 1); if (vd->fAverage) CP_XML_ATTR(L"avgSubtotal", 1);
if (vd->fMax) CP_XML_ATTR(L"maxSubtotal", 1); if (vd->fMax) CP_XML_ATTR(L"maxSubtotal", 1);
...@@ -147,6 +146,7 @@ int PIVOTVD::serialize(std::wostream & strm) ...@@ -147,6 +146,7 @@ int PIVOTVD::serialize(std::wostream & strm)
{ {
CP_XML_ATTR(L"rankBy", vd_ex->isxdiAutoShow); CP_XML_ATTR(L"rankBy", vd_ex->isxdiAutoShow);
} }
if (!vd->fDefault) CP_XML_ATTR(L"defaultSubtotal", 0);
if (!m_arSXVI.empty()) if (!m_arSXVI.empty())
{ {
CP_XML_NODE(L"items") CP_XML_NODE(L"items")
......
...@@ -137,7 +137,7 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -137,7 +137,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
core->m_arPIVOTVD[i]->serialize(CP_XML_STREAM()); core->m_arPIVOTVD[i]->serialize(CP_XML_STREAM());
} }
} }
if (core->m_arPIVOTIVD.size() == 2)//0 or 2 if (core->m_arPIVOTIVD.size() >= 1)
{ {
CP_XML_NODE(L"rowFields") CP_XML_NODE(L"rowFields")
{ {
...@@ -147,7 +147,7 @@ int PIVOTVIEW::serialize(std::wostream & strm) ...@@ -147,7 +147,7 @@ int PIVOTVIEW::serialize(std::wostream & strm)
ivd->serialize(CP_XML_STREAM()); ivd->serialize(CP_XML_STREAM());
} }
} }
if (core->m_arPIVOTLI.size() == 2)//0 or 2 if (core->m_arPIVOTLI.size() >= 1)//0 or 2
{ {
CP_XML_NODE(L"rowItems") CP_XML_NODE(L"rowItems")
{ {
......
...@@ -47,6 +47,7 @@ SXOPER::SXOPER() ...@@ -47,6 +47,7 @@ SXOPER::SXOPER()
bDate = false; bDate = false;
bNumber = false; bNumber = false;
bEmpty = false; bEmpty = false;
bInteger= false;
} }
SXOPER::~SXOPER() SXOPER::~SXOPER()
...@@ -67,7 +68,16 @@ const bool SXOPER::loadContent(BinProcessor& proc) ...@@ -67,7 +68,16 @@ const bool SXOPER::loadContent(BinProcessor& proc)
} }
else if(proc.optional<SXNum>()) else if(proc.optional<SXNum>())
{ {
bNumber = true;
SXNum *num = dynamic_cast<SXNum*>(elements_.back().get());
if (num)
{
bInteger = (num->num.data.bytes.Byte1==num->num.data.bytes.Byte2 &&
num->num.data.bytes.Byte2==num->num.data.bytes.Byte3 &&
num->num.data.bytes.Byte3==num->num.data.bytes.Byte4 &&
num->num.data.bytes.Byte4==0);
}
bNumber = !bInteger;
} }
else if(proc.optional<SxBool>()) else if(proc.optional<SxBool>())
{ {
......
...@@ -57,6 +57,7 @@ public: ...@@ -57,6 +57,7 @@ public:
bool bDate; bool bDate;
bool bNumber; bool bNumber;
bool bEmpty; bool bEmpty;
bool bInteger;
}; };
} // namespace XLS } // namespace XLS
......
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