JAVA对Excel的操作 jExcel篇

1) 去这里下一个jexcel(有native调用,感觉不是很爽!) 
http://www.teamdev.com/jexcel/downloads.jsf 
 
JExcel v1.2 
  - JExcel library 
  - JExcel Demo (with source code) 
  - Programmer's Guide 
  - Bundled with JNIWrapper and ComfyJ 
  - Samples 
 
Download * 2.03 MB 
 
2) http://www.teamdev.com/jexcel/index.jsf 
evaluation license key. 
申请一个试用的key,之后你的邮箱会收到说明 
Assembly code 
Dear bootupnow,
 
Thanks for your interest in JExcel library.
 
Attached you will find the evaluation key to unlock a full-featured version of JExcel for a period of 30 days starting from today [Wed Jul 16 10:09:10 CDT 2008].
 
Please rename the attached file "license._zip" into "license.zip".
For installation instructions, please see the "readme.txt" file inside the JExcel download package.
 
Your successful evaluation is important to us. Feel free to contact us if you have any questions about the product.
For technical questions, please e-mail to jexcel-support@teamdev.com or visit our support forum.
For general questions, please e-mail to info@teamdev.com or visit our support forum.
We hope you will enjoy using JExcel!
 
 
Sincerely,
TeamDev Ltd.
http://www.teamdev.com
 
+1 425 223-3079 (US)
+380 57 766-0163 (UA)
Monday to Friday, 11 a.m.–7 p.m. (GMT+2).
    license.zip
2K   Download   
 
 
3) 按照Readme.txt的说明配置。 
Assembly code 
The  JExcel package  downloadable  from  JNIWrappper  Download  page  contains
following:
- JNIWrapper Native Library (jniwrap.dll)
- JNIWrapper Library (jniwrap.jar)
- ComfyJ Library (comfyj.jar)
- WinPack Library (winpack.jar)

备注:上面四个文件,如果是application就要放在C:\WINDOWS\system32下,如果是web service project,就要放在服务器的bin目录下
- Programmer's Guides for JNIWrapper, ComfyJ and JExcel products
- JExcel usage examples source code
- JExcel Demo application and its source code
- JExcel License file (License.txt)
- This Readme file
 
   Installing Library JAR Files
   ----------------------------
JExcel uses JNIWrapper, ComfyJ and WinPack  products,  so  all  these  JAR  files 
should be in the application class path. 
 
Native JNIWrapper library (jniwrap.dll) is required  for  JExcel  and  it  should 
be placed in the working directory of a Java application.
 
All license files should be placed along with native JNIWrapper library or in the
application's JAR file, in its META-INF folder.
 
 
4) 按照jexcel的JExcel Programmer's Guide就可以开始操作excel了 
Java code 
import java.io.File;
import java.io.IOException;
 
import com.jniwrapper.win32.jexcel.Application;
import com.jniwrapper.win32.jexcel.ExcelException;
import com.jniwrapper.win32.jexcel.FileFormat;
import com.jniwrapper.win32.jexcel.Workbook;
 
public class Test {
    public static void doSomething(){
        try {
            Application application = new Application();
            application.setVisible(true);
            Workbook workbook = application.createWorkbook("title");
            workbook.setPassword("123"); // 需要密码是123才能打开excel文件。
            workbook.saveAs(new File("C:/test.xls"),FileFormat.WORKBOOKNORMAL, true);
            workbook.close(true);
        } catch (ExcelException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }         
    }
    
    public static void main(String[] args) {        
        doSomething();
    }

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值