简体   繁体   中英

Applying a second conditional_format() with Xlsxwriter Python

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM