xlwt模块支持间接吗?
我使用了以下代码,但它不起作用。我检查了 xls。公式已正确填写,但仍保留为文本条目。如果按 ENTER 键激活该单元格,则可以。
sheet1.write(1, 1, xlwt.Formula('INDIRECT(\"\'sheet1\'!B1\")'))
我发现 INDIRECT 在 xlwt\ExcelMagic.py 中声明:
all_funcs_by_name = {
# Includes Analysis ToolPak aka ATP aka add-in aka xcall functions,
# distinguished by -ve opcode.
# name: (opcode, min # args, max # args, func return type, func arg types)
# + in func arg types means more of the same.
...
'INDIRECT' : (148, 1, 2, 'R', 'VV'),
...
任何人都可以建议如何使用 INDIRECT 公式吗?
I used the following codes, but it doesn't work. I checked the xls. The formula is filled in correctly, but remains as a text entry. If to press ENTER to active this cell, it works.
sheet1.write(1, 1, xlwt.Formula('INDIRECT(\"\'sheet1\'!B1\")'))
I find INDIRECT is declared in xlwt\ExcelMagic.py:
all_funcs_by_name = {
# Includes Analysis ToolPak aka ATP aka add-in aka xcall functions,
# distinguished by -ve opcode.
# name: (opcode, min # args, max # args, func return type, func arg types)
# + in func arg types means more of the same.
...
'INDIRECT' : (148, 1, 2, 'R', 'VV'),
...
Can anyone suggest how to use INDIRECT formula?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
xlwt
在编译包含一些应返回引用的函数的公式时存在问题。这在 OpenOffice Calc 和 Gnumeric 中并不重要,它们似乎遵循“做我的意思”的理念。在 Excel 2003 中,您需要选择单元格,然后按 F2(强制它将公式从 xlwt 生成的字节码反编译为文本),然后按Enter
(使其将文本编译为它满意的字节码) )。在我的优先事项列表中,这方面的工作排在很低的位置。xlwt
has issues with compiling formulas that contain some functions that should return references. This doesn't matter in OpenOffice Calc and Gnumeric, which appear to operate on a "do what I mean" philosophy. In Excel 2003, you need to select the cell then hit F2 (forces it to decompile the formula from xlwt-generated bytecode to text) followed byEnter
(makes it compile the text into bytecode that it's happy with). Working on this is very low on my list of priorities.