Compare commits

..

1 Commits

Author SHA1 Message Date
dd3dd1e42a [x2t] For bug 38295 2018-08-06 19:47:20 +03:00
2 changed files with 48 additions and 39 deletions

View File

@ -182,26 +182,30 @@ void OOX::Spreadsheet::CCell::PrepareForBinaryWriter()
}
else if(SimpleTypes::Spreadsheet::celltypeStr == m_oType->GetValue() || SimpleTypes::Spreadsheet::celltypeError == m_oType->GetValue())
{
if(!xlsx->m_pSharedStrings)
xlsx->CreateSharedStrings();
std::wstring sValue;
if(m_oValue.IsInit())
sValue = m_oValue->ToString();
//добавляем в SharedStrings
CSi* pSi = new CSi();
CText* pText = new CText();
pText->m_sText = sValue;
pSi->m_arrItems.push_back(pText);
int nIndex = xlsx->m_pSharedStrings->AddSi(pSi);
//меняем значение ячейки
m_oValue.Init();
m_oValue->m_sText = std::to_wstring(nIndex);
//меняем тип ячейки
if(SimpleTypes::Spreadsheet::celltypeStr == m_oType->GetValue())
if (m_oValue.IsInit())
{
m_oType.Init();
m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
if(!xlsx->m_pSharedStrings)
xlsx->CreateSharedStrings();
//добавляем в SharedStrings
CSi* pSi = new CSi();
CText* pText = new CText();
pText->m_sText = m_oValue->ToString();
pSi->m_arrItems.push_back(pText);
int nIndex = xlsx->m_pSharedStrings->AddSi(pSi);
//меняем значение ячейки
m_oValue.Init();
m_oValue->m_sText = std::to_wstring(nIndex);
//меняем тип ячейки
if(SimpleTypes::Spreadsheet::celltypeStr == m_oType->GetValue())
{
m_oType.Init();
m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
}
}
else
{
m_oValue.reset();
m_oType.reset();
}
}
else if(SimpleTypes::Spreadsheet::celltypeBool == m_oType->GetValue())
@ -220,4 +224,4 @@ void OOX::Spreadsheet::CCell::PrepareForBinaryWriter()
}
}
}
}
}

View File

@ -423,26 +423,31 @@ void OOX::Spreadsheet::CXlsx::PrepareWorksheet(CWorksheet* pWorksheet)
}
else if(SimpleTypes::Spreadsheet::celltypeStr == pCell->m_oType->GetValue() || SimpleTypes::Spreadsheet::celltypeError == pCell->m_oType->GetValue())
{
if(!m_pSharedStrings) CreateSharedStrings();
std::wstring sValue;
if(pCell->m_oValue.IsInit())
sValue = pCell->m_oValue->ToString();
//добавляем в SharedStrings
CSi* pSi = new CSi();
CText* pText = new CText();
pText->m_sText = sValue;
pSi->m_arrItems.push_back(pText);
int nIndex = m_pSharedStrings->AddSi(pSi);
//меняем значение ячейки
pCell->m_oValue.Init();
pCell->m_oValue->m_sText = std::to_wstring(nIndex);
//меняем тип ячейки
if(SimpleTypes::Spreadsheet::celltypeStr == pCell->m_oType->GetValue())
if (pCell->m_oValue.IsInit())
{
pCell->m_oType.Init();
pCell->m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
if(!m_pSharedStrings) CreateSharedStrings();
//добавляем в SharedStrings
CSi* pSi = new CSi();
CText* pText = new CText();
pText->m_sText = pCell->m_oValue->ToString();
pSi->m_arrItems.push_back(pText);
int nIndex = m_pSharedStrings->AddSi(pSi);
//меняем значение ячейки
pCell->m_oValue.Init();
pCell->m_oValue->m_sText = std::to_wstring(nIndex);
//меняем тип ячейки
if(SimpleTypes::Spreadsheet::celltypeStr == pCell->m_oType->GetValue())
{
pCell->m_oType.Init();
pCell->m_oType->SetValue(SimpleTypes::Spreadsheet::celltypeSharedString);
}
}
else
{
pCell->m_oValue.reset();
pCell->m_oType.reset();
}
}
else if(SimpleTypes::Spreadsheet::celltypeBool == pCell->m_oType->GetValue())