We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The example given in the doc:
>>> from openpyxl.styles import Border, Side, PatternFill, Font, GradientFill, Alignment >>> from openpyxl import Workbook >>> >>> wb = Workbook() >>> ws = wb.active >>> ws.merge_cells('B2:F4') >>> >>> top_left_cell = ws['B2'] >>> top_left_cell.value = "My Cell" >>> >>> thin = Side(border_style="thin", color="000000") >>> double = Side(border_style="double", color="ff0000") >>> >>> top_left_cell.border = Border(top=double, left=thin, right=thin, bottom=double) >>> top_left_cell.alignment = Alignment(horizontal="center", vertical="center") >>> >>> wb.save("styled.xlsx")
does not work for bottom and right borders.
The text was updated successfully, but these errors were encountered:
For me, the code works if I move merging the cells to after doing all the styling as shown below:
>>> from openpyxl.styles import Border, Side, PatternFill, Font, GradientFill, Alignment >>> from openpyxl import Workbook >>> >>> wb = Workbook() >>> ws = wb.active >̶>̶>̶ ̶w̶s̶.̶m̶e̶r̶g̶e̶_̶c̶e̶l̶l̶s̶(̶'̶B̶2̶:̶F̶4̶'̶)̶ >>> >>> top_left_cell = ws['B2'] >>> top_left_cell.value = "My Cell" >>> >>> thin = Side(border_style="thin", color="000000") >>> double = Side(border_style="double", color="ff0000") >>> >>> top_left_cell.border = Border(top=double, left=thin, right=thin, bottom=double) >>> top_left_cell.alignment = Alignment(horizontal="center", vertical="center") >>> >>> ws.merge_cells('B2:F4') >>> >>> wb.save("styled.xlsx")
Sorry, something went wrong.
No branches or pull requests
The example given in the doc:
does not work for bottom and right borders.
The text was updated successfully, but these errors were encountered: