xlsxwriter - 更改评论中的字体

问题描述 投票:4回答:2

是否可以在xlsxwriter中更改注释格式 - write_comment()我想在那里使用等宽字体,如'Courier New',我不知道该怎么做。有什么建议?

python excel xlsxwriter
2个回答
2
投票

最后,在github上对此功能请求的更改请求之后有一个提交。这是提交:https://github.com/jmcnamara/XlsxWriter/commit/d49552c9c07e30900a120eca2f73226e682c31f2,即你必须使用最新的Master版本。

然后你可以使用:

worksheet.write_comment('B2', 'Some text', {'font_name': 'MS Gothic', 'font_family': 3, 'font_size': 10})

3
投票

根据Working with Cell Comments文档段落,xlsxwriter不允许您更改注释中使用的默认字体。您可以更改的唯一选项是:

author
visible
x_scale
width
y_scale
height
color
start_cell
start_row
start_col
x_offset
y_offset

xlsxwriter问题跟踪器上创建了一个github问题,被@jmcnamara标记为“功能请求”:

© www.soinside.com 2019 - 2024. All rights reserved.