openpyxl合并的单元格:格式问题 [英] openpyxl merged cells: Formatting issue
问题描述
说我有一个xlsx文件,并且此Excel文件具有合并的单元格A2和B2.我还选择了该合并的单元格,并在合并的单元格的顶部和底部放置了一个边框.
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.
当我执行以下操作时:
wb = openpyxl.load_workbook("file.xlsx")
wb.save("resulting file.xlsx")
结果是, A 列中只有合并单元格周围的部分才具有边框:
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) -
问题#378-缺少边框在不同的单元格上的边缘打开并保存现有的excel文件
这篇关于openpyxl合并的单元格:格式问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!