Applying a second conditional_format() with Xlsxwriter Python

Viewed 174

I'm applying a format of a right border with one condition but when I try to apply a bottom border with another condition the cell with the first condition does not apply the bottom border. Is there a way to apply 2 conditional_format to one cell?

right_border_format = wb.add_format({
    'right': 5
    })
right_border_format.set_locked(False)

bottom_border_format = wb.add_format({
    'bottom': 5
})
bottom_border_format.set_locked(False)

worksheet.conditional_format(0, 10, 10, 10, {'type' : 'no_errors' , 'format' : right_border_format})

worksheet.conditional_format(4, 10, 4, 10, {'type' : 'no_errors' , 'format' : bottom_border_format})

The cell that needs to have a right border and a bottom border have only a right border.

1 Answers

I don't think this is possible. The simplest way is probably to create a 3rd conditional format that includes both borders...

that being said - the OG Creator of xlsxwriter - John McNamara has commented on your post. If it's not possible in Excel using the dialog, it's not possible with xlsxwriter.

Related