Xlsxwriter 在将背景填充应用于范围时替换文本
Xlsxwriter Replacing text when applying background fill to range
我正在使用 xlsxwriter 在一个范围内应用背景填充,在执行此操作时,它会替换在该特定范围内书写的文本。
请不要建议使用条件格式。
这就是我正在做的事情:
for row in range(8,9):
for col in range(2,13):
cell_reference = xl_rowcol_to_cell (row, col, row_abs=True, col_abs=True)
worksheet.write ('{}'.format (cell_reference), None, format_header)
所以输入是:
预期输出:
代码输出:
查看其替换 headers。
I'm applying a background fill in a range using xlsxwriter and while doing this, it is replacing the text written on that particular range.
这就是 XlsxWriter 的工作方式。您将需要用数据编写格式。你不能单独做。
此外,请注意,您无需创建单元格引用即可传递给 write()
,它可以采用数字 (row, col)
。请参阅文档的 Working with Cell Notation 部分。
我正在使用 xlsxwriter 在一个范围内应用背景填充,在执行此操作时,它会替换在该特定范围内书写的文本。 请不要建议使用条件格式。
这就是我正在做的事情:
for row in range(8,9):
for col in range(2,13):
cell_reference = xl_rowcol_to_cell (row, col, row_abs=True, col_abs=True)
worksheet.write ('{}'.format (cell_reference), None, format_header)
所以输入是:
预期输出:
代码输出:
查看其替换 headers。
I'm applying a background fill in a range using xlsxwriter and while doing this, it is replacing the text written on that particular range.
这就是 XlsxWriter 的工作方式。您将需要用数据编写格式。你不能单独做。
此外,请注意,您无需创建单元格引用即可传递给 write()
,它可以采用数字 (row, col)
。请参阅文档的 Working with Cell Notation 部分。