openpyxl.worksheet.merge module

class openpyxl.worksheet.merge.MergeCell(ref=None)[source]

Bases: openpyxl.worksheet.cell_range.CellRange

ref

Excel-style representation of the range

tagname = 'mergeCell'
class openpyxl.worksheet.merge.MergeCells(count=None, mergeCell=())[source]

Bases: openpyxl.descriptors.serialisable.Serialisable

count
mergeCell

A sequence (list or tuple) that may only contain objects of the declared type

tagname = 'mergeCells'
class openpyxl.worksheet.merge.MergedCellRange(worksheet, coord)[source]

Bases: openpyxl.worksheet.cell_range.CellRange

MergedCellRange stores the border information of a merged cell in the top left cell of the merged cell. The remaining cells in the merged cell are stored as MergedCell objects and get their border information from the upper left cell.

format()[source]

Each cell of the merged cell is created as MergedCell if it does not already exist.

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.