styler#
- class Styler(bg_color: str | None = None, bold: bool = False, font: str = 'Arial', font_size: int | float = 12.0, font_color: str | None = None, number_format: str = 'General', protection: bool = False, underline: str | None = None, border_type: str | Set[str] | Dict[str, str] = 'thin', horizontal_alignment: str = 'center', vertical_alignment: str = 'center', wrap_text: bool = True, shrink_to_fit: bool = True, fill_pattern_type: str = 'solid', indent: int | float = 0.0, comment_author: str | None = None, comment_text: str | None = None, text_rotation: int = 0, date_format: str = 'DD/MM/YY', time_format: str = 'HH:MM', date_time_format: str = 'DD/MM/YY HH:MM', strikethrough: bool = False, italic: bool = False)[source]#
Used to represent a style
- Parameters:
bg_color (str: one of
utils.colors
, hex string or color name ie ‘yellow’ Excel supports) – The background colorbold (bool) – If
True
, a bold typeface is usedfont (str: one of
utils.fonts
or other font name Excel supports) – The font to usefont_size (int) – The font size
font_color (str: one of
utils.colors
, hex string or color name ie ‘yellow’ Excel supports) – The font colornumber_format (str: one of
utils.number_formats
or any other format Excel supports) – The format of the cell’s valueprotection (bool) – If
True
, the cell/column will be write-protectedunderline (str: one of
utils.underline
or any other underline Excel supports) – The underline type
Changed in version 4.2.
- Parameters:
border_type (str or set[str] or dict[str, str]) –
If provided a string (one of
utils.borders
or any other border type Excel supports): all borders will be set to that type.If provided a set of strings (
utils.border_locations
or any other border location Excel supports): each provided border will be set to the default border type.If provided a dict (from location, one of
utils.border_locations
or any other border location Excel supports) to border type (one ofutils.borders
or any other border type Excel supports): each provided border will be set to the provided border type.
New in version 1.2.
- Parameters:
horizontal_alignment (str: one of
utils.horizontal_alignments
or any other horizontal alignment Excel supports) – Text’s horizontal alignmentvertical_alignment (str: one of
utils.vertical_alignments
or any other vertical alignment Excel supports) – Text’s vertical alignment
New in version 1.3.
- Parameters:
New in version 4.0.
- Parameters:
date_format (str: one of
utils.number_formats
or any other format Excel supports) –time_format (str: one of
utils.number_formats
or any other format Excel supports) –date_time_format (str: one of
utils.number_formats
or any other format Excel supports) –
Note
For any of
date_format
,time_format
anddate_time_format
to take effect, the value being styled must be an actualdate
/time
/datetime
object.New in version 4.1.