mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
Fix bugs in html to ooxml conversion
This commit is contained in:
@ -70,7 +70,7 @@ namespace NSCSS
|
||||
{L"deepskyblue", L"00BFFF"}, {L"dodgerblue", L"1E90FF"}, {L"cornflowerblue",L"6495ED"},
|
||||
{L"mediumdlateblue", L"7B68EE"}, {L"royalblue", L"4169E1"}, {L"blue", L"0000FF"}, {L"LightCoral", L"#F08080"}, {L"LightCoral", L"#F08080"}, {L"LightCoral", L"#F08080"},
|
||||
{L"mediumblue", L"0000CD"}, {L"darkblue", L"00008B"}, {L"navy", L"000080"},
|
||||
{L"midnightblue", L"191970"},
|
||||
{L"midnightblue", L"191970"}, {L"navyblue", L"A0B0E0"},
|
||||
/* White tones */
|
||||
{L"white", L"FFFFFF"}, {L"snow", L"FFFAFA"}, {L"honeydew", L"F0FFF0"},
|
||||
{L"mintcream", L"F5FFFA"}, {L"azure", L"F0FFFF"}, {L"aliceblue", L"F0F8FF"},
|
||||
|
||||
@ -2300,9 +2300,7 @@ namespace NSCSS
|
||||
|
||||
CFont &CFont::operator+=(const CFont &oFont)
|
||||
{
|
||||
if (!oFont.m_oSize.Empty())
|
||||
m_oSize = oFont.m_oSize;
|
||||
|
||||
m_oSize += oFont.m_oSize;
|
||||
m_oLineHeight += oFont.m_oLineHeight;
|
||||
m_oFamily += oFont.m_oFamily;
|
||||
m_oStretch += oFont.m_oStretch;
|
||||
|
||||
@ -272,8 +272,15 @@ namespace NSCSS
|
||||
|
||||
if (oStyle.Empty())
|
||||
return;
|
||||
|
||||
oXmlElement.AddPropertiesInP(PProperties::P_Jc, oStyle.m_oText.GetAlign().ToWString());
|
||||
|
||||
const bool bInTable{oStyle.HaveThisParent(L"table")};
|
||||
|
||||
std::wstring wsTextAlign{oStyle.m_oText.GetAlign().ToWString()};
|
||||
|
||||
if (wsTextAlign.empty() && bInTable)
|
||||
wsTextAlign = oStyle.m_oDisplay.GetHAlign().ToWString();
|
||||
|
||||
oXmlElement.AddPropertiesInP(PProperties::P_Jc, wsTextAlign);
|
||||
|
||||
std::wstring sInfValue;
|
||||
sInfValue.reserve(64);
|
||||
@ -317,10 +324,10 @@ namespace NSCSS
|
||||
oXmlElement.AddPropertiesInP(PProperties::P_ContextualSpacing, L"true");
|
||||
}
|
||||
|
||||
if (!oStyle.m_oBackground.Empty() && !oStyle.HaveThisParent(L"table"))
|
||||
if (!oStyle.m_oBackground.Empty() && !bInTable)
|
||||
oXmlElement.AddPropertiesInP(PProperties::P_Shd, oStyle.m_oBackground.IsNone() ? L"auto" : oStyle.m_oBackground.GetColor().ToWString());
|
||||
|
||||
if (!oStyle.m_oBorder.Empty() && !oStyle.HaveThisParent(L"table"))
|
||||
if (!oStyle.m_oBorder.Empty() && !bInTable)
|
||||
{
|
||||
if (oStyle.m_oBorder.EqualSides())
|
||||
{
|
||||
@ -450,7 +457,7 @@ namespace NSCSS
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Highlight, wsHighlight);
|
||||
|
||||
oXmlElement.AddPropertiesInR(RProperties::R_Color, oStyle.m_oText.GetColor().ToWString());
|
||||
|
||||
|
||||
std::wstring wsFontFamily{oStyle.m_oFont.GetFamily().ToWString()};
|
||||
|
||||
if (L"sans-serif" == wsFontFamily)
|
||||
@ -466,6 +473,8 @@ namespace NSCSS
|
||||
|
||||
bool CDocumentStyle::WriteRStyle(const NSCSS::CCompiledStyle& oStyle)
|
||||
{
|
||||
Clear();
|
||||
|
||||
if(oStyle.GetId().empty())
|
||||
{
|
||||
m_sId = L"normal";
|
||||
@ -479,7 +488,7 @@ namespace NSCSS
|
||||
if (oItem != m_arStyleUsed.end())
|
||||
{
|
||||
m_sId = (*oItem).getId();
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
CXmlElement oXmlElement;
|
||||
@ -488,7 +497,6 @@ namespace NSCSS
|
||||
if (oXmlElement.Empty())
|
||||
return false;
|
||||
|
||||
structStyle.setId(oXmlElement.GetStyleId());
|
||||
m_arStyleUsed.push_back(structStyle);
|
||||
m_sStyle += oXmlElement.GetRStyle();
|
||||
|
||||
|
||||
@ -597,7 +597,7 @@ std::wstring CXmlElement::GetPStyle(bool bIsLite) const
|
||||
{
|
||||
if (bIsLite)
|
||||
return ConvertPStyle(true);
|
||||
|
||||
|
||||
return GetStyle(true, true, false);
|
||||
}
|
||||
|
||||
@ -605,7 +605,7 @@ std::wstring CXmlElement::GetRStyle(bool bIsLite) const
|
||||
{
|
||||
if (bIsLite)
|
||||
return ConvertRStyle(true);
|
||||
|
||||
|
||||
return GetStyle(true, false, true);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user