该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
from xlrd import open_workbook
from xlwt import easyxf
from xlutils.copy import copy
# customise this to your needs, have more than one style
# if you need it
mystyle = easyxf('font:color red;')
rb = open_workbook('1.xls',formatting_info=True)
wb = copy(rb)
# do whatever modifications you need
wb.get_sheet(0).write(2,4,'some value',mystyle)
wb.save('1.xls')
运行之后:
Traceback (most recent call last):
File "C:\Documents and Settings\jinfu\桌面\test.py", line 38, in
wb = copy(rb)
File "C:\Python25\Lib\site-packages\xlutils\copy.py", line 13, in copy
w
File "C:\Python25\Lib\site-packages\xlutils\filter.py", line 812, in process
reader(chain[0])
File "C:\Python25\Lib\site-packages\xlutils\filter.py", line 67, in __call__
if workbook.on_demand:
AttributeError: 'Book' object has no attribute 'on_demand'
我的python版本是2.5的,要求装的包也装过了,就是不行!求高手指点迷津。。。。