Skip to content

Instantly share code, notes, and snippets.

@jedy
Created July 25, 2012 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jedy/3174051 to your computer and use it in GitHub Desktop.
Save jedy/3174051 to your computer and use it in GitHub Desktop.
python里用java的模块SmartXLS[http://www.smartxls.com/indexj.htm]和jpype修改excel
# -*- 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