I just upgraded from openpyxl 1.6.2 to 2.02 and asked a question about setting cell colors.
The Styles function must handle all necessary formatting and includes the use of the Fill function to set the cell color. This last function has fill_type as one of its arguments. How do you set a solid fill for this? In previous versions, this was done using the following:
mycell.style.fill.fill_type = Fill.FILL_SOLID
The documentation, which looks like it works, seems to suggest that setting fill_type = Fill.FILL_SOLID will do the trick (scroll down to the notes at the bottom of the page). But I'm trying to get the AttributeError attribute.
from openpyxl.styles import Fill, Color from openpyxl.styles.colors import RED redfill = Fill(fill_type=Fill.FILL_SOLID,start_color=RED) Traceback (most recent call last): File "<pyshell#20>", line 1, in <module> redfill = Fill(fill_type=Fill.FILL_SOLID,start_color=RED) AttributeError: type object 'Fill' has no attribute 'FILL_SOLID'
Any thoughts?
source share