Skip to content

MergedCells are only created for the purpose of writing.

Bitbucket Importer requested to merge bitbucket/merged-pr-265 into branch/2.6

Created originally on Bitbucket by mschieder (Magnus Schieder)

Was already merged in Bitbucket before import, marked as merged by the import user

See https://bitbucket.org/openpyxl/openpyxl/pull-requests/261/fix-for-missing-borders/diff

Now the MergedCells are only created for the purpose of writing, so they can't disturb any other parts of openpyxl.

test_style_assignment in openpyxl/reader/tests test_excel.py

Saving the border style to the top-left cell will create a new border style for that cell.

Old border style of the top-left cell:

<border>
  <left style="mediumDashed">
    <color theme="6"/>
  </left>
  <right/>
  <top style="mediumDashed">
     <color theme="6"/>
  </top>
  <bottom/>
  <diagonal/>
</border>

New border style of the top-left cell:

<border>
  <left style="mediumDashed">
    <color theme="6"/>
  </left>
  <right style="mediumDashed">
    <color theme="6"/>
  </right>
  <top style="mediumDashed">
    <color theme="6"/>
  </top>
  <bottom style="mediumDashed">
    <color theme="6"/>
  </bottom>
  <diagonal/>
</border>

The old border style is not deleted, the number of border styles (len(wb._borders)) is higher.
In this test there is only one style for merge-cells and therefore one additional border.

Merge request reports

Loading