Cell style name remains same even after NamedStyle assigned to cell
Created originally on Bitbucket by asovetnikov (Artem Sovetnikov)
This code produces "Normal Normal Normal" (three times Normal).
Expected result is "Normal style1 style1"
empty.xlsx is empty spreadsheet from Excel.
#!python
from openpyxl import load_workbook
from openpyxl.styles import NamedStyle
wb = load_workbook('q:\\temp\\empty.xlsx')
cell = wb.worksheets[0].cell(row=1,column=1)
print(cell.style)
ns = NamedStyle(name='style1')
cell.style = ns
print(cell.style)
cell.style = ns.name
print(cell.style)
Seems named style xfId is lost when StyleArray copy made in last line of NamedStyleDescriptor.set
This behavior prevents style copy from cell to cell just by source cell style name.