Skip to content

Commit

Permalink
Merge branch 'text-rotation' into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
DeepSpace2 committed Jun 18, 2019
2 parents c5e42c6 + 54065c6 commit f2c8bfa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ __init__(self, bg_color=None, bold=False, font=utils.fonts.arial, font_size=12,
border_type=utils.borders.thin, horizontal_alignment=utils.horizontal_alignments.center,
vertical_alignment=utils.vertical_alignments.center, wrap_text=True, shrink_to_fit=True,
fill_pattern_type=utils.fill_pattern_types.solid, indent=0,
comment_author=None, comment_text=None)
comment_author=None, comment_text=None, text_rotation=0)
```
Object that represents the style of a cell in our excel file.
Styler is responsible of storing the style of single cell.
Expand Down
9 changes: 6 additions & 3 deletions StyleFrame/styler.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def __init__(self, bg_color=None, bold=False, font=utils.fonts.arial, font_size=
number_format=utils.number_formats.general, protection=False, underline=None,
border_type=utils.borders.thin, horizontal_alignment=utils.horizontal_alignments.center,
vertical_alignment=utils.vertical_alignments.center, wrap_text=True, shrink_to_fit=True,
fill_pattern_type=utils.fill_pattern_types.solid, indent=0, comment_author=None, comment_text=None):
fill_pattern_type=utils.fill_pattern_types.solid, indent=0, comment_author=None, comment_text=None,
text_rotation=0):

def get_color_from_string(color_str, default_color=None):
if color_str and color_str.startswith('#'):
Expand All @@ -44,6 +45,7 @@ def get_color_from_string(color_str, default_color=None):
self.indent = indent
self.comment_author = comment_author
self.comment_text = comment_text
self.text_rotation = text_rotation

def __eq__(self, other):
if not isinstance(other, self.__class__):
Expand Down Expand Up @@ -86,7 +88,7 @@ def to_openpyxl_style(self):
fill=PatternFill(patternType=self.fill_pattern_type, fgColor=self.bg_color),
alignment=Alignment(horizontal=self.horizontal_alignment, vertical=self.vertical_alignment,
wrap_text=self.wrap_text, shrink_to_fit=self.shrink_to_fit,
indent=self.indent),
indent=self.indent, text_rotation=self.text_rotation),
border=border,
number_format=self.number_format,
protection=Protection(locked=self.protection)
Expand Down Expand Up @@ -146,6 +148,7 @@ def _calc_lum_from_tint(color_tint, current_lum):
shrink_to_fit = openpyxl_style.alignment.shrink_to_fit
fill_pattern_type = openpyxl_style.fill.patternType
indent = openpyxl_style.alignment.indent
text_rotation = openpyxl_style.alignment.text_rotation

if openpyxl_comment:
comment_author = openpyxl_comment.author
Expand All @@ -158,7 +161,7 @@ def _calc_lum_from_tint(color_tint, current_lum):
number_format, protection, underline,
border_type, horizontal_alignment,
vertical_alignment, wrap_text, shrink_to_fit,
fill_pattern_type, indent, comment_author, comment_text)
fill_pattern_type, indent, comment_author, comment_text, text_rotation)

@classmethod
def combine(cls, *styles):
Expand Down
4 changes: 3 additions & 1 deletion docs/api_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ Used to represent a style.
number_format=utils.number_formats.general, protection=False, underline=None,
border_type=utils.borders.thin, horizontal_alignment=utils.horizontal_alignments.center,
vertical_alignment=utils.vertical_alignments.center, wrap_text=True, shrink_to_fit=True,
fill_pattern_type=utils.fill_pattern_types.solid, indent=0, comment_author=None, comment_text=None)
fill_pattern_type=utils.fill_pattern_types.solid, indent=0, comment_author=None, comment_text=None,
text_rotation=0)

:bg_color: (str: one of :ref:`utils.colors`, hex string or color name ie `'yellow'` Excel supports) The background color
:bold: (bool) If `True`, a bold typeface is used
Expand All @@ -210,6 +211,7 @@ Used to represent a style.
:indent: (int)
:comment_author: (str)
:comment_text: (str)
:text_rotation: (int) 1 - 180

Methods
*******
Expand Down

0 comments on commit f2c8bfa

Please sign in to comment.