Created
July 25, 2012 02:35
-
-
Save jedy/3174051 to your computer and use it in GitHub Desktop.
python里用java的模块SmartXLS[http://www.smartxls.com/indexj.htm]和jpype修改excel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf8 -*- | |
""" | |
使用java的模块SmartXLS[http://www.smartxls.com/indexj.htm]和jpype修改excel | |
和xlrd,xlwt不同的是它可以生成和保持图表 | |
""" | |
from __future__ import print_function, division | |
import os | |
import 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") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment