how to highlight cell in openpyxl

Solutions on MaxInterview for how to highlight cell in openpyxl by the best coders in the world

showing results for - "how to highlight cell in openpyxl"
Baxter
21 Jun 2016
1>>> from openpyxl.styles import PatternFill, Border, Side, Alignment, Protection, Font
2>>> font = Font(name='Calibri',
3...                 size=11,
4...                 bold=False,
5...                 italic=False,
6...                 vertAlign=None,
7...                 underline='none',
8...                 strike=False,
9...                 color='FF000000')
10>>> fill = PatternFill(fill_type=None,
11...                 start_color='FFFFFFFF',
12...                 end_color='FF000000')
13>>> border = Border(left=Side(border_style=None,
14...                           color='FF000000'),
15...                 right=Side(border_style=None,
16...                            color='FF000000'),
17...                 top=Side(border_style=None,
18...                          color='FF000000'),
19...                 bottom=Side(border_style=None,
20...                             color='FF000000'),
21...                 diagonal=Side(border_style=None,
22...                               color='FF000000'),
23...                 diagonal_direction=0,
24...                 outline=Side(border_style=None,
25...                              color='FF000000'),
26...                 vertical=Side(border_style=None,
27...                               color='FF000000'),
28...                 horizontal=Side(border_style=None,
29...                                color='FF000000')
30...                )
31>>> alignment=Alignment(horizontal='general',
32...                     vertical='bottom',
33...                     text_rotation=0,
34...                     wrap_text=False,
35...                     shrink_to_fit=False,
36...                     indent=0)
37>>> number_format = 'General'
38>>> protection = Protection(locked=True,
39...                         hidden=False)
40>>>
41