This commit is contained in:
Green
2025-01-30 00:49:49 +03:00
parent cc8fa641aa
commit 3609cf1237
3 changed files with 41 additions and 8 deletions

View File

@ -713,6 +713,8 @@ void CConverter2OOXML::WriteTable(const CCtrlTable* pTable, short shParaShapeID,
if (nullptr == pTable || pTable->Empty())
return;
CloseParagraph(oBuilder, oState);
++m_ushTableCount;
oBuilder.WriteString(L"<w:tbl>");
@ -860,8 +862,8 @@ void CConverter2OOXML::WriteCell(const CTblCell* pCell, NSStringUtils::CStringBu
if (0 == oCellBuilder.GetCurSize())
{
OpenParagraph(pParagraph->GetShapeID(), oBuilder, oState);
CloseParagraph(oBuilder, oState);
OpenParagraph(pParagraph->GetShapeID(), oBuilder, oCellState);
CloseParagraph(oBuilder, oCellState);
}
else
oBuilder.Write(oCellBuilder);
@ -2099,7 +2101,15 @@ HWP_STRING CConverter2OOXML::AddRelationship(const HWP_STRING& wsType, const HWP
if (m_arRelationships.cend() != itFound)
return itFound->m_wsID;
m_arRelationships.push_back({L"rId" + std::to_wstring(m_arRelationships.size() + 1), wsType, wsTarget});
if (L"hyperlink" == wsType)
{
NSStringUtils::CStringBuilder oBuilder;
oBuilder.WriteEncodeXmlString(wsTarget);
m_arRelationships.push_back({L"rId" + std::to_wstring(m_arRelationships.size() + 1), wsType, oBuilder.GetData()});
}
else
m_arRelationships.push_back({L"rId" + std::to_wstring(m_arRelationships.size() + 1), wsType, wsTarget});
return m_arRelationships.back().m_wsID;
}

View File

@ -123,8 +123,8 @@ void COleConverter::CreateChart(CHWPStream& oOleStream)
NSStringUtils::CStringBuilder oRelsData;
oRelsData.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
oRelsData.WriteString(L"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
oRelsData.WriteString(L"<Relationship Id=\"rId1\" Type=\"http://schemas.microsoft.com/office/2011/relationships/chartStyle\" Target=\"style1.xml\"/>");
oRelsData.WriteString(L"<Relationship Id=\"rId2\" Type=\"http://schemas.microsoft.com/office/2011/relationships/chartColorStyle\" Target=\"colors1.xml\"/>");
oRelsData.WriteString(L"<Relationship Id=\"rId1\" Type=\"http://schemas.microsoft.com/office/2011/relationships/chartStyle\" Target=\"style" + std::to_wstring(m_unCountCharts) + L".xml\"/>");
oRelsData.WriteString(L"<Relationship Id=\"rId2\" Type=\"http://schemas.microsoft.com/office/2011/relationships/chartColorStyle\" Target=\"colors" + std::to_wstring(m_unCountCharts) + L".xml\"/>");
oRelsData.WriteString(L"</Relationships>");
NSFile::CFileBinary oRelsFile;

View File

@ -318,10 +318,33 @@ CHWPFile* CHWPDocInfo::GetParentHWP()
const CHWPRecord* CHWPDocInfo::GetBinData(const HWP_STRING& sID) const
{
if (m_mBinDatas.end() == m_mBinDatas.find(sID))
return nullptr;
switch (m_eHanType)
{
case EHanType::HWP:
{
short shID = std::stoi(sID) - 1;
return m_mBinDatas.at(sID);
if (shID >= m_mBinDatas.size())
return nullptr;
std::map<HWP_STRING, CHWPRecord*>::const_iterator itElement = m_mBinDatas.cbegin();
for (unsigned short ushIndex = 0; ushIndex < shID; ++ushIndex)
++itElement;
return itElement->second;
}
case EHanType::HWPX:
{
if (m_mBinDatas.end() == m_mBinDatas.find(sID))
return nullptr;
return m_mBinDatas.at(sID);
break;
}
default:
return nullptr;
}
}
EHanType CHWPDocInfo::GetHanType() const