Commit 765677d9 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - pivots errors value, ..

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