First, thanks a lot for this wonderful library.
I'm trying to apply a style to an entire row and noticed that the documentation is not right here.
https://openpyxl.readthedocs.org/en/latest/styles.html>>> from openpyxl.workbook import Workbook
>>> from openpyxl.styles import Font, Fill
>>> wb = Workbook()
>>> ws = wb.active
>>> c = ws['A1']
>>> row = ws.row_dimensions[1]
>>>
row.style = Font(underline="single")Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/rakesh.varma/Envs/sm_reports/lib/python2.7/site-packages/openpyxl/styles/styleable.py", line 124, in style
self.font = value.font.copy()
AttributeError: 'Font' object has no attribute 'font'
>>>
Font cannot be directly applied to the style. Instead, Style object needs to created with a font in it.
Eg:
from openpyxl.styles import Style
row.style = Style(Font(underline="single"))Please let me know if this is a documentation issue or a bug. I've tested it on this version.
openpyxl==2.2.1
Thanks,
Rakesh