Skip to content

Fix for missing borders.

Bitbucket Importer requested to merge bitbucket/merged-pr-261 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/issues/988/merge-cells-loosing-style-information

When dealing with merged Cells, Excel and Libreoffice create phantom cells to keep border information for merged cells. This is unwanted behaviour. Openpyxl eleminates those phantom cells.

Excel and Libreoffice receive the fills and the positioning from the upper left cell of the merged cell.

MergedCellRange stores the border information of a merged cell in the top left cell of the merged cell. For this the upper left cell gets the border information of the bottom and right border from the bottom right cell of the merged cell, if available. The remaining cells in the merged cell are stored as MergedCell objects. The MergedCells at the edge of the merged cell gets its borders from the upper left cell.

- The top MergedCells get the top border from the top left cell.
- The bottom MergedCells get the bottom border from the top left cell.
- The left MergedCells get the left border from the top left cell.
- The right MergedCells get the right border from the top left cell.

When formatting the top left cell of the merged cell, the complete merged cell is formatted.

Merge request reports