Hi,
thanks for the report.
ws['A1'].number_format
'#,###'
ws['A2'].number_format
'#,###' # format was copied
ws['A2'].number_format = '0.0000%'
ws['A2'].number_format
'0.0000%'
In 2.0 we made styles immutable to prevent the styles of different cells
being affected when the style of one was changed. Unfortunately, this
imposes quite a performance penalty as Python doesn't really have the
concept of locking objects after creation, and the interface was very
clunky with the .copy() method.
But some style attributes such as `number_format` have always been
directly assignable (as it's just a string we never check what the value
is). This did change in 2.1 and may be being ignored by the .copy()
method. This is going to be the case for all going forward so that along
with c.number_format = '#,###' you'll be able to do c.font = Font(…) so
that the Style object can be relegated.
Charlie
--
Charlie Clark
Managing Director
Clark Consulting & Research
German Office
Kronenstr. 27a
Düsseldorf
D- 40217
Tel:
+49-211-600-3657
Mobile:
+49-178-782-6226