Fixed a problem with incorrect display of table borders

This commit is contained in:
Kirill Poljakov
2022-05-17 18:50:51 +03:00
parent 03bfb325cd
commit 72cde59fdb
7 changed files with 60 additions and 38 deletions

View File

@ -362,6 +362,7 @@ namespace NSCSS
}
//PADDING
CASE(L"padding"):
CASE(L"mso-padding-alt"):
{
if (bIsThereBorder)
break;
@ -385,6 +386,7 @@ namespace NSCSS
break;
}
CASE(L"padding-top"):
CASE(L"mso-padding-top-alt"):
{
if (bIsThereBorder)
break;
@ -408,6 +410,7 @@ namespace NSCSS
break;
}
CASE(L"padding-right"):
CASE(L"mso-padding-right-alt"):
{
if (bIsThereBorder)
break;
@ -432,6 +435,7 @@ namespace NSCSS
break;
}
CASE(L"padding-bottom"):
CASE(L"mso-padding-bottom-alt"):
{
if (bIsThereBorder)
break;
@ -455,6 +459,7 @@ namespace NSCSS
break;
}
CASE(L"padding-left"):
CASE(L"mso-padding-left-alt"):
{
if (bIsThereBorder)
break;

View File

@ -502,6 +502,8 @@ namespace NSCSS
});
}
pStyle->AddStyle(arSelectors[i].m_mAttrs, i + 1);
for (const CElement* oElement : arFindElements)
pStyle->AddStyle(oElement->GetStyle(), i + 1);

View File

@ -3,7 +3,7 @@
#include <string>
#include <vector>
//#include <map>
#include <map>
namespace NSCSS
{
@ -13,7 +13,7 @@ namespace NSCSS
std::wstring m_sClass; // Класс тэга
std::wstring m_sId; // Id тэга
std::wstring m_sStyle; // Стиль тэга
//std::map<std::wstring, std::wstring> m_mAttrs; // Остальные аттрибуты тэга
std::map<std::wstring, std::wstring> m_mAttrs; // Остальные аттрибуты тэга
CNode(){};
CNode(std::wstring sName, std::wstring sClass, std::wstring sId) : m_sName(sName), m_sClass(sClass), m_sId(sId){};

View File

@ -1738,7 +1738,7 @@ namespace NSCSS
bool Empty() const
{
return fWidth <= 0;
return fWidth < 0;
}
void SetWidthWithoutChecking(const float& fWidth, const unsigned int& unLevel, const bool &bHardMode = false)
@ -1926,7 +1926,10 @@ namespace NSCSS
std::wstring GetStyle() const
{
return (bBlock) ? L"auto" : sStyle;
if (bBlock) return L"auto";
if (0 == fWidth) return L"none";
else if (L"auto" == sStyle) return L"single";
else return sStyle;
}
std::wstring GetColor() const
@ -1979,7 +1982,7 @@ namespace NSCSS
else if (iswdigit(sValue[0]))
{
const float fWidth = wcstof(sValue.c_str(), NULL);
if (fWidth > 0.0f)
if (fWidth >= 0.0f)
oBorderSide.fWidth = fWidth;
}
else if (sValue.substr(0, 3) == L"rgb")

View File

@ -279,6 +279,8 @@ namespace NSCSS
sSpacingValue += L"w:after=\"" + oStyle.m_pMargin.GetTopSide() + L"\" ";
sSpacingValue += L"w:before=\"" + oStyle.m_pMargin.GetTopSide() + L"\" ";
}
else if (!oStyle.m_pBorder.Empty())
sSpacingValue += L"w:after=\"0\" w:before=\"0\" ";
const std::wstring &sLineHeight = oStyle.m_pFont.GetLineHeight();
if (!sLineHeight.empty())
@ -286,6 +288,8 @@ namespace NSCSS
sSpacingValue += L"w:line=\"" + sLineHeight + L"\" ";
sSpacingValue += L"w:lineRule=\"auto\"";
}
else if (!oStyle.m_pBorder.Empty())
sSpacingValue += L"w:line=\"240\" w:lineRule=\"auto\" ";
if (!sSpacingValue.empty())
{
@ -308,7 +312,7 @@ namespace NSCSS
const std::wstring sBorderStyle = oStyle.m_pBorder.GetStyleBottomSide();
const std::wstring sBorderWidth = oStyle.m_pBorder.GetWidthBottomSideW();
const std::wstring sBorder = L" w:color=\"" + sBorderColor + L"\" w:space=\"4\" w:sz=\"" +
const std::wstring sBorder = L" w:color=\"" + sBorderColor + L"\" w:space=\"0\" w:sz=\"" +
sBorderWidth + L"\" w:val=\"" + sBorderStyle + L"\"";
oXmlElement.AddPropertiesInP(NSConstValues::NSProperties::ParagraphProperties::P_TopBorder, sBorder);