DifferentialStyle Border behavior
Created originally on Bitbucket by roman2git (Roman)
Hi, I got "unexpected" behavior when work with conditional formatting.
Expected: when condition is true - draw dxf sides if set and draw cell border sides for other sides.
With openpyxl: if condition is true draw dxf sides if set and draw None for other sides.
So the issue is that I can't say to draw top border with conditional formatting when the cell already has it's formats because the cell borders would be lost. The cause of issue: openpyxl.styles.borders class generate all Sides by default so the dxf would have all sides defined and xml would have all tags (even empty). However the Excel natively doesn't put any not defined Sides in border. Here is comparison of dxf xmls:
- Excel (manually):
#!xml
<dxf xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">
<fill>
<patternFill>
<bgColor theme="7" tint="-0.24994659260841701"/>
</patternFill>
</fill>
<border>
<top style="thin">
<color rgb="FF503CE6"/>
</top>
<bottom style="thin">
<color rgb="FF503CE6"/>
</bottom>
<vertical/>
<horizontal/>
</border>
</dxf>
- With openpyxl:
#!xml
<dxf xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">
<font>
<b/>
</font>
<fill>
<patternFill>
<bgColor rgb="FFFABF8F"/>
</patternFill>
</fill>
<border>
<left/>
<right/>
<top style="thin">
<color rgb="FF1A3C7B"/>
</top>
<bottom style="thin">
<color rgb="FF1A3C7B"/>
</bottom>
</border>
</dxf>
I think there should be different class (or its behavior) of Border for dxfs.
Also I'd like to thank you for the great module!
Attachments: borders.pyexcel_rule.xlsxopenpyxl_mod_rule.xlsxopenpyxl_rule.xlsxtest_mod_scr.pytest_scr.pytmpl.xlsx