空白工作簿由WriteOnlyCell和文档中的示例输出

2024-09-27 21:25:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在使用bitbucket存储库中的openpyxl 2.2.6。我尝试了documentation中的简单示例

但是,这会生成一个空白工作簿,其中有一个被恰当命名为“MyTestSheet”的工作表。但任何单元格中的值。在

我还缺什么能给手机写东西呢。在

from openpyxl import Workbook
wb = Workbook(optimized_write = True)
ws = wb.create_sheet(title="MyTestSheet")
from openpyxl.writer.dump_worksheet import WriteOnlyCell
from openpyxl.comments import Comment
from openpyxl.styles import Style, Font
cell = WriteOnlyCell(ws, value="hello world")
cell.font = Font(name='Courrier', size=36)
cell.comment = Comment(text="A comment", author="Author's Name")
wb.save("testwr_so.xlsx")

Tags: fromimport示例bitbucketwsdocumentationcommentcell

热门问题