Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
O
openpyxl
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 202
    • Issues 202
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 2
    • Merge Requests 2
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • openpyxl
  • openpyxl
  • Issues
  • #1154

Closed
Open
Created Dec 21, 2018 by Bitbucket Importer@bitbucket_importerOwner

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

Edited Jan 08, 2021 by CharlieC
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None