java²Ù×÷excel
Java+Excelѧϰ
over140 ÕûÀí ¸üУº2006-06-19 12:25:18 °æ±¾: 1.0
½üÁ½ÌìÑо¿²é¿´ÁËÏÂJava+ExcelµÄ·½·¨
Ê×ÏÈÐèÒªµ½ÍøÉÏϸöjxl.jarµÄ°ü
ÎÒдµÄÁ·Ï°´úÂëÈçÏÂ:(×¢ÒâÀïÃæµÄÍ¼Æ¬Ìæ»»³É×Ô¼ºµÄ¾Í¿ÉÒÔÁË)
import java.io.*;
import java.util.Random;
import java.util.Date;
import jxl.*;
import jxl.format.UnderlineStyle;
import jxl.write.*;
import jxl.write.Number;
import jxl.write.Boolean;
public class CreateXL
{
public CreateXL()
{
}
public static void main(String[] args)
{
//¶ÁExcel
//CreateXL.readExcel("d:/abc.xls");
//´´½¨ÐµÄExcel
CreateXL.writeExcel("d:/new.xls");
//¸üÐÂExcel
CreateXL.updateExcel("d:/new.xls");
}
//jxlÔÝʱ²»ÌṩÐÞ¸ÄÒѾ´æÔÚµÄÊý¾Ý±í,ÕâÀïͨ¹ýÒ»¸öС°ì·¨À´´ïµ½Õâ¸öÄ¿µÄ,²»ÊʺϴóÐÍÊý¾Ý¸üÐÂ!
//ÕâÀïÊÇͨ¹ý¸²¸ÇÔÎļþÀ´¸üеÄ.
public static void updateExcel(String filePath)
{
try
{
Workbook rwb = Workbook.getWorkbook(new File(filePath));
WritableWorkbook wwb = Workbook.createWorkbook(new File("d:/new.xls"),rwb);//copy
WritableSheet ws = wwb.getSheet(0);
WritableCell wc = ws.getWritableCell(0,0);
//Åжϵ¥Ôª¸ñµÄÀàÐÍ,×ö³öÏàÓ¦µÄת»»
Label label = (Label)wc;
label.setString("The value has been modified");
&n
Ïà¹ØÎĵµ£º
×î½üÓöµ½Ò»¸öÐèÇóÒªÔÚlinuxÏÂÓÃjava µ÷ÓÃmysql¿Í»§¶ËÔ¶³ÌµÇ½mysql·þÎñÆ÷£¬´Ó¿Í»§¶Ë»úÆ÷µ¼Èëmysql½Å±¾£¬´Ómysql·þÎñÆ÷¶Ëµ¼³ö±íÖеÄÊý¾Ý¡£ÒÔÏÂÊÇÓõ½µÄÖ÷Òª·½·¨£º
Java ´úÂë
/**
* µ¼ÈëÊý¾Ý
* @param ½Å±¾µÄµØÖ·ºÍÃû³Æ
* @return ÊÇ·ñ³ ......
¾ÙÀý×Ó˵Ã÷Ò»ÇС£
JAVA_HOME£º C:\j2sdk1.4.2_13
Path£º C:\j2sdk1.4.2_13\bin;
Classpath£º.;JAVA_HOME\lib\tools.jar ; JAVA_HOME\lib\dt.jar;
&n ......
1.Listת»»³ÉΪÊý×é¡££¨ÕâÀïµÄListÊÇʵÌåÊÇArrayList)
µ÷ÓÃArrayListµÄtoArray·½·¨¡£
Àý£ºString[] arr = (String[])list.toArray(new String[size]);
2.Êý×éת»»³ÉΪList¡£
µ÷ÓÃArraysµÄasList·½·¨¡£
Àý£ºList stooges = Arrays.asList("Larry", "Moe", "Curly"); ......
Ò»¡¢Ê²Ã´ÊÇJavaÐéÄâ»ú
µ±Äã̸µ½JavaÐéÄâ»úʱ£¬Äã¿ÉÄÜÊÇÖ¸£º
1¡¢³éÏóµÄJavaÐéÄâ»ú¹æ·¶
2¡¢Ò»¸ö¾ßÌåµÄJavaÐéÄâ»úʵÏÖ
3¡¢Ò»¸öÔËÐеÄJavaÐéÄâ»úʵÀý
¶þ¡¢JavaÐéÄâ»úµÄÉúÃüÖÜÆÚ
Ò»¸öÔËÐÐ ......