我正在尝试使用以下代码在一系列单元格上绘制外部边框:
import xlsxwriter
first_row = 9
last col = 3
last_row = 13
last_col = 6
workbook = xlsxwriter.Workbook(output)
worksheet = workbook.add_worksheet()
# Right
worksheet.conditional_format(first_row, last_col, last_row, last_col, {'type':'formula', 'criteria':'True', 'format':workbook.add_format({'right':2})})
# Bottom
worksheet.conditional_format(last_row, first_col, last_row, last_col, {'type':'formula', 'criteria':'True', 'format':workbook.add_format({'bottom':2})})
# Left
worksheet.conditional_format(first_row, first_col, last_row, first_col, {'type':'formula', 'criteria':'True', 'format':workbook.add_format({'left':2})})
# Top
worksheet.conditional_format(first_row, first_col, first_row, last_col, {'type':'formula', 'criteria':'True', 'format':workbook.add_format({'top':2})})
我也用另一种不同的方式做到了,通过循环每个单元格在顶部、左侧、右侧和底部单元格上添加边框来绘制输出边框,我得到了相同的结果。
我在 XL 电子表格中得到以下内容。问题是为什么顶部和底部边界线没有闭合。谢谢你
尝试更改坐标代码