Commit 765677d9 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - pivots errors value, ..

parent 6afc38c8
...@@ -39,6 +39,7 @@ namespace XLS ...@@ -39,6 +39,7 @@ namespace XLS
DConRef::DConRef() DConRef::DConRef()
{ {
index_external = -1; index_external = -1;
bFilePath = false;
} }
...@@ -54,7 +55,7 @@ BaseObjectPtr DConRef::clone() ...@@ -54,7 +55,7 @@ BaseObjectPtr DConRef::clone()
void DConRef::readFields(CFRecord& record) void DConRef::readFields(CFRecord& record)
{ {
GlobalWorkbookInfoPtr global_info_ = record.getGlobalWorkbookInfo(); global_info_ = record.getGlobalWorkbookInfo();
record >> ref >> cchFile; record >> ref >> cchFile;
...@@ -77,6 +78,8 @@ void DConRef::readFields(CFRecord& record) ...@@ -77,6 +78,8 @@ void DConRef::readFields(CFRecord& record)
int pos = sTmp.find(L"\x0001"); int pos = sTmp.find(L"\x0001");
if (pos >= 0) if (pos >= 0)
{ {
bFilePath = true;
path.push_back(sTmp.substr(0, pos)); path.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1); sTmp = sTmp.substr(pos + 1);
continue; continue;
...@@ -91,6 +94,8 @@ void DConRef::readFields(CFRecord& record) ...@@ -91,6 +94,8 @@ void DConRef::readFields(CFRecord& record)
pos = sTmp.find(L"\x0003"); pos = sTmp.find(L"\x0003");
if (pos >= 0) if (pos >= 0)
{ {
bFilePath = true;
path.push_back(sTmp.substr(0, pos)); path.push_back(sTmp.substr(0, pos));
sTmp = sTmp.substr(pos + 1); sTmp = sTmp.substr(pos + 1);
continue; continue;
...@@ -111,8 +116,12 @@ void DConRef::readFields(CFRecord& record) ...@@ -111,8 +116,12 @@ void DConRef::readFields(CFRecord& record)
int unused = record.getDataSize() - record.getRdPtr(); int unused = record.getDataSize() - record.getRdPtr();
record.skipNunBytes(unused); record.skipNunBytes(unused);
}
void DConRef::check_external()
{
bool bFound = false; bool bFound = false;
for (size_t i = 0; i < global_info_->sheets_names.size(); i++) // todooo отдельно??? for (size_t i = 0; i < global_info_->sheets_names.size(); i++) // todooo отдельно???
{ {
if (global_info_->sheets_names[i] == sheet_name) if (global_info_->sheets_names[i] == sheet_name)
...@@ -121,7 +130,8 @@ void DConRef::readFields(CFRecord& record) ...@@ -121,7 +130,8 @@ void DConRef::readFields(CFRecord& record)
break; break;
} }
} }
if (!bFound && (!path.empty() || !file_name.empty()))
if (!bFound && (!path.empty() || !file_name.empty()) && bFilePath)
{//external sheet {//external sheet
std::wstring full_path; std::wstring full_path;
if (!path.empty()) if (!path.empty())
...@@ -149,6 +159,8 @@ void DConRef::readFields(CFRecord& record) ...@@ -149,6 +159,8 @@ void DConRef::readFields(CFRecord& record)
std::wstring DConRef::get_external_path() std::wstring DConRef::get_external_path()
{ {
if (path.empty() && file_name.empty()) return L"";
std::wstring result = L"file:///"; std::wstring result = L"file:///";
for (size_t i = 0; i < path.size(); i++) for (size_t i = 0; i < path.size(); i++)
......
...@@ -62,8 +62,13 @@ public: ...@@ -62,8 +62,13 @@ public:
std::wstring sheet_name; std::wstring sheet_name;
int index_external; int index_external;
void check_external();
private: private:
GlobalWorkbookInfoPtr global_info_;
std::wstring get_external_path(); std::wstring get_external_path();
bool bFilePath;
}; };
} // namespace XLS } // namespace XLS
......
...@@ -116,6 +116,8 @@ int DREF::serialize(std::wostream & strm) ...@@ -116,6 +116,8 @@ int DREF::serialize(std::wostream & strm)
} }
else if(ref) else if(ref)
{ {
ref->check_external();
CP_XML_ATTR(L"type", L"worksheet"); CP_XML_ATTR(L"type", L"worksheet");
CP_XML_NODE(L"worksheetSource") CP_XML_NODE(L"worksheetSource")
{ {
......
...@@ -258,8 +258,8 @@ int FDB::serialize(std::wostream & strm, bool bSql) ...@@ -258,8 +258,8 @@ int FDB::serialize(std::wostream & strm, bool bSql)
{ {
CP_XML_ATTR(L"containsMixedTypes", 1); CP_XML_ATTR(L"containsMixedTypes", 1);
if (bInteger) bNumber = true; if (bInteger) bNumber = true;
if (bEmpty && bNumber) bInteger = false; else if (bEmpty && bNumber) bInteger = false;
} }
else if (!bEmpty && !bString && !bBool) else if (!bEmpty && !bString && !bBool)
{ {
......
...@@ -97,10 +97,18 @@ const bool SXOPER::loadContent(BinProcessor& proc) ...@@ -97,10 +97,18 @@ const bool SXOPER::loadContent(BinProcessor& proc)
else if(proc.optional<SxErr>()) else if(proc.optional<SxErr>())
{ {
SxErr* err = dynamic_cast<SxErr*>(elements_.back().get()); SxErr* err = dynamic_cast<SxErr*>(elements_.back().get());
//bNumber = true;
bString = true; bString = true;
node = L"e"; node = L"e";
value = L"#VALUE!";//std::to_wstring(err->wbe); switch(err->wbe)
{
case 0x00: value = L"NULL!"; break;
case 0x07: value = L"#DIV/0!"; break;
case 0x0F: value = L"#VALUE!"; break;
case 0x17: value = L"#REF!"; break;
case 0x1D: value = L"#NAME?"; break;
case 0x24: value = L"#NUM!"; break;
case 0x2A: value = L"#N/A"; break;
}
} }
else if(proc.optional<SXString>()) else if(proc.optional<SXString>())
{ {
......
...@@ -205,6 +205,8 @@ int SXTBL::serialize(std::wostream & strm) ...@@ -205,6 +205,8 @@ int SXTBL::serialize(std::wostream & strm)
} }
if (ref) if (ref)
{ {
ref->check_external();
CP_XML_ATTR(L"ref", ref->ref.toString()); CP_XML_ATTR(L"ref", ref->ref.toString());
CP_XML_ATTR(L"sheet", ref->sheet_name); CP_XML_ATTR(L"sheet", ref->sheet_name);
......
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