openpyxl 单元格样式报告不正确
使用 python 库 openpyxl 我正在读取在 excel 2007 中创建的 XLSX 文件。除了单元格 A1 之外,它是空的,单元格 A1 为黄色,并且其中写入了值“test”。我可以轻松地从该单元格检索值,但是当我尝试确定填充颜色时,我得到以下结果:
this_sheet.cell("A1").style.fill.start_color
返回“FFFFFF”
this_sheet.cell("A1").style.fill.end_color
返回“FF0000”
在其他空白单元格上测试此值,我得到完全相同的结果,并尝试检索字体样式信息不断返回 calibri 大小 11(我们的系统默认值)。
我这一切都错了吗?我应该使用其他方法吗? 任何帮助将不胜感激。
谢谢!
Using the python library openpyxl I am reading an XLSX file created in excel 2007. it is empty apart from cell A1 which is coloured yellow and has the value "test" written in it. I can easily retrieve the value from that cell, however when I attempt to determine the fill colour I get the following results:
this_sheet.cell("A1").style.fill.start_color
returns "FFFFFF"
this_sheet.cell("A1").style.fill.end_color
returns "FF0000"
Testing this on other blank cells I get exactly the same results, and trying to retrieve the font style information keeps returning calibri size 11 (our system default).
Am I going about this all wrong? Is there an alternative method i should be using?
Any help would be greatly appreciated.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Openpyxl 仍处于开发阶段,样式尚未完全实现,因此您可能会遇到一些问题。如果您愿意,请随时在项目错误跟踪器上提出问题。
Openpyxl is still in development, and styles are not yet completely implemented, thus you can encounter some issues here and there. Don't hesitate to open an issue on the project bug tracker if you want.