Reputation: 3300
I'm writing some pandas dataframes to an excel file. I was wondering if it's possible to write a format to have just a thick right border for example. I tried the below:
center_thick_rborder = workbook.add_format({'align' : 'center',
'right' : True,
'border':5})
but it just applied a thick border to every border in the column, where I only want the right border. Is this possible? If so, how?
I've seen this question which is where I got the 'border':5
bit from in the above code. I've also seem this question which didn't help me.
Upvotes: 2
Views: 1456
Reputation: 41584
You need to set the border thickness for the right
property, like this:
import xlsxwriter
workbook = xlsxwriter.Workbook('test.xlsx')
worksheet = workbook.add_worksheet()
center_thick_rborder = workbook.add_format({'align': 'center',
'right': 5})
worksheet.write(1, 1, 'foo', center_thick_rborder)
worksheet.write(2, 1, 'bar', center_thick_rborder)
worksheet.write(3, 1, 'baz', center_thick_rborder)
workbook.close()
Output:
Upvotes: 3