Worksheet.merge_cells store wrong cells ranges when we extend already-merged cells.
For Instance, I have the following worksheet:
ws = Worksheet(Workbook()) ws.merge_cells(start_row=1, start_column=1, end_row=4, end_column=4) assert ws._merged_cells == ["A1:D4"]
If I want to extend the merged cells to "A1:E4" (one more column), I do:
ws.merge_cells(start_row=1, start_column=1, end_row=4, end_column=5) print(ws._merged_cells)
As a result, I have:
Which generates a corrupted file (according to Excel 2010).
I think, the
Worksheet.merge_cells should compare the coordinates of already-merged cells with the ones of the parameters.
m_coord= coordinates of already-merged cells,
p_coord= coordinates given by the parameters
Here is the tests we can do on each coordinates of already-merged cells:
p_coordare disjoint: ignore -> pass
p_coord: extend m_coord
- else: raise an exception