在XlsxWriter写入后,将格式应用于单元格 [英] Apply format to a cell after being written in XlsxWriter

查看:2900
本文介绍了在XlsxWriter写入后,将格式应用于单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用XlsxWriter在python上工作,我一直在努力解决这个问题,没有成功:



我的应用程序必须创建一个Xlsx文件,其中显示数据在一个桌子的结构。
该表有一些空单元格。



我想为某些单元格设置边框,为表格创建一个网格,所以我使用:

  format6 = excelbook.add_format()
format6.set_left(1)
for y in range(24):
excel.write(y + 5,1,None,format6)

为了已将边界应用于这些单元格。然后,我在表格上写数据。



由于表格布局相当复杂,写入数据很容易,一旦写入完成,就将格式应用于单元格有边界,但我找不到方式。



有没有办法将格式应用到单元格,一旦它被写在之前而不会丢失其内容? p>

提前谢谢。

解决方案

模块,不幸的是这是不可能的。



这是一个计划功能和(一小部分)内部基础设施的一部分是支持它,但目前不可用,我不能说什么时候。


I work on python using XlsxWriter and I've been trying to solve this problem with no success:

My app must create an Xlsx file in which data is shown in a table-like structure. That table has some empty cells.

I'd like to set borders to some cells to make a grid for the table so I use:

format6 = excelbook.add_format()
format6.set_left(1)
for y in range(24):
    excel.write(y+5, 1, None, format6)

in order to have border applied to those cells. Then, I write data on the table.

Since the table layout is quite complex, it would be easy to write data and, once everything is written, apply format to cells to have borders, but I can't find the way.

Is there any way to apply format to a cell once it's been written previously without losing its content?

Thank you in advance.

解决方案

I'm the author of that module and unfortunately that isn't possible.

It is a planned feature, and (a small) part of the internal infrastructure is there to support it, but it isn't currently available and I can't say when it will be.

这篇关于在XlsxWriter写入后,将格式应用于单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆