python里用java的模块SmartXLS和jpype修改excel文件,smartxlsjpype,# -*- coding


# -*- coding: utf8 -*-"""使用java的模块SmartXLS[http://www.smartxls.com/indexj.htm]和jpype修改excel和xlrd,xlwt不同的是它可以生成和保持图表"""from __future__ import print_function, divisionimport osimport jpype# os.environ['JAVA_HOME'] = "/usr/lib64/jvm/default-java"jpype.startJVM(jpype.getDefaultJVMPath(), '-Djava.class.path=SX.jar')WorkBook = jpype.JClass('com.smartxls.WorkBook')w = WorkBook()w.read("b.xls")w.setNumber(0, 2, 0, 20.0)w.write("c.xls")

评论关闭