Crash when trying to use Rich Text in cells
Hello, I am trying to create an XLSX file using "Rich Text". When following the example, I get a crash:
File "[/cad/freeware/python-3.9.7/lib/python3.9/site-packages]...]/openpyxl-3.1.2-py3.9.egg/openpyxl/cell/_writer.py", line 87, in etree_write_cell
File "[/cad/freeware/python-3.9.7/lib/python3.9/site-packages]...]/openpyxl-3.1.2-py3.9.egg/openpyxl/xml/functions.py", line 85, in whitespace
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'strip'
This seems to be caused by the reuse of variable name "text" for 2 different things in "cell/_writer.py":
for r in value:
se = SubElement(inline_string, 'r')
if isinstance(r, TextBlock):
se2 = SubElement(se, 'rPr')
se2.append(r.font.to_tree())
text = r.name
else:
text = r
**text** = SubElement(se, 't')
text.text = **text**
whitespace(text)
Note: when fixing this variable, there is also an issue on "r.name" which does not exist (AttributeError: 'TextBlock' object has no attribute 'name') which looks like should be "r.text" instead.