范围边界在xlsxwriter中

时间:2018-04-05 06:42:23

标签: python xlsxwriter

我正在尝试使用条件格式类型“no_blanks”在范围内应用边框。但是当在范围内左上角和右上角应用时,它不适用并且仅应用底部。 知道为什么会这样吗?

        format_left_col = workbook.add_format({"left":2})
        format_right_col = workbook.add_format({"right":2})
        format_bottom_col = workbook.add_format({"bottom":2})
        format_top_col = workbook.add_format({"top":2})
        worksheet.conditional_format(row_end,1,row_end,1,{"type":"no_blanks","format":format_left_col})
        worksheet.conditional_format(row_end,7,row_end,7,{"type":"no_blanks","format":format_right_col})
        worksheet.conditional_format(row_end, 1, row_end, 7, {"type":"no_blanks", "format":format_top_col})
        worksheet.conditional_format(row_end, 1, row_end, 7, {"type":"no_blanks", "format":format_bottom_col})

当前输出: enter image description here 预期输出 enter image description here

0 个答案:

没有答案