Say I have an xlsx-file and this Excel file has cells A2 and B2 merged. I also select that merged cell and put a border at the top and bottom of the merged cell.
When I do the following:
wb = openpyxl.load_workbook("file.xlsx")
wb.save("resulting file.xlsx")
The result is that only the portion around the merged cell that is in column A now has the border:
Is there a way to prevent this from happening?
I believe you are facing Issue#365 , there is generally an issue around styling for merged cells, I believe the above mentioned issues tracks it.
Sadly, I do not see any workaround for this issue, neither is any such workaround mentioned in the issue linked.
Another issue that is more directly related to the one you are facing (it is closed as duplicate of the above mentioned issue) -
Issue#378 - Missing border edges on different cells on open and save existing excel file