ʹÓÃJAVAͨ¹ýJXL(JExcel)¶¯Ì¬Éú³ÉExcelÎļþ
ÉÏ´Î談過ÁËʹÓÃiText產ÉúPDF檔£¬這´Î換³É來談談ʹÓÃJExcel來產ÉúEXCEL檔µÄ·½·¨¡£
Ê×ÏÈ£¬Ïȵ½ËûµÄSourceForgeÖ÷頁ÃædownloadÏà關µÄAPI檔°¸¡£
http://sourceforge.net/projects/jexcelapi/
»ò
http://www.andykhan.com/jexcelapi/download.html
當È»£¬ËûÒ²ÊÇOpenSourceµÄÔª¼þ¡£
ÏÂÁÐ為ÆäTutorial½Ì學£º
http://www.andykhan.com/jexcelapi/tutorial.html
Ò»ÇоÍ緒áᣬÄǾÍ準備ÉÏ·ÁË¡£
ÏÂ載ÏÂ來µÄ壓縮檔½â開áᣬ¿ÉÒÔÕÒµ½jxl.jar£¬ÏÈ將´Ë檔°¸¼ÓÈëÄãµÄClasspathÖаɣ¡
1. ÏȽ¨Á¢Workbook
Ò²¾ÍÊÇÕû·ÝµÄExcel檔°¸£¬¿ÉÖ¸¶¨檔Ãû¡£
Workbook workbook = Workbook.getWorkbook(new File("test.xls"));
2. ½¨Á¢Sheet
Ò²¾ÍÊÇÿ個Excel檔°¸ÏÂÃæ¿ÉÒÔÌøtagµÄsheet±í¡£
Sheet sheet = workbook.createSheet("ÎÒµÄExcel±í", 0);
µÚÒ»個參數ÊÇsheet name£¬µÚ¶þ個參數ÊǵÚ幾張sheet£¬當È»indexÊÇÓÉ0開ʼËã¡£
3. ½¨Á¢×ÖÐÍ
WritableFont chFont11w = new WritableFont(WritableFont.TIMES, 11);
chFont11w.setColour(Colour.WHITE);
ÏȽ¨Á¢Ò»個WritableFontµÄinstance£¬ÆäconstructorµÄµÚÒ»個參數ÊÇÖ¸¶¨×ÖÐÍ£¬µÚ¶þ個ÊÇ×ÖÐÍ´óС¡£
ÆäÖÐ×ÖÐ͵IJ¿·Ý£¬¿ÉÒÔʹÓÃWritableFontËùÌṩ預設µÄÒ»¶Ñstatic³£數來Ö¸¶¨£¬
Ò²¿ÉÒÔÖ±½Ó輸Èëstring£¬±ÈÈç´ò"標¿¬體"£¬µ½時產ÉúµÄ×ÖÐ;Í會ÒÀÕÕÄãËùÖ¸¶¨µÄ來顯ʾ¡£
¶øsetColourÊÇÖ¸¶¨´Ë×ÖÐ͵Ä顏É«£¬這個²¿·Ý¾ÍÂé煩¡£
(ÓÉcolour這個×Ö來¿´£¬ºÜ顯È»µÄJExcel應ÊÇÓ¢國Ïà關µÄÈË開發µÄ:P ·´Õý總Ö®²»會ÊÇÃÀ國)
顏É«為ʲ麼Âé煩ÄØ£¿ÔÚJExcel裡Ã棬Colour class並²»Ìṩpublic constructor讓user×Ô¼ºÖ¸¶¨RGBµÄ顏É«£¬
ËùÒÔÄãÖ»ÄÜ從ColourÖÐÒ»¶ÑµÄstatic³£數顏É«來Ö¸¶¨£¬Ö®Ç°為ÁË這個問題還Ñо¿ÁËÒ»ÏÂËûµÄÔʼ
Ïà¹ØÎĵµ£º
µ½SunÍøÕ¾ÏÂÔØ×Ô½âѹ°²×°°üjdk-xxxx.bin
°²×°£º
[root@RHEL4 JDK-1.5.0.06]# chmod +x jdk-xxxx.bin
[root@RHEL4 JDK-1.5.0.06]# ./jdk-xxxx.bin
Ñ¡Ôñ°²×°Î»Öã¬
J2SDK°²×°Ä¿Â¼£º /usr/local/jdk
ÅäÖÃJava»·¾³±äÁ¿£º
ÔÚ ~/.bash_profile Àï¼ÓÈëÏÂÁм¸Ðл·¾³±äÁ¿¼´¿É£º
export JAVA_HOME=/usr/local/jdk
export PAT ......
1.Ç°ÑÔ£º
ÄãµÄ³ÌÐò×ÜÓÐÒ»Ìì»á±ÀÀ£µô£¬ÔÚ±ÀÀ£µôµÄʱºòÎÒÃÇÒªÖªµÀËüÔÚÄÄ£¬ÎªÁËʲô¶ø±ÀÀ£µô£¬Êý¾ÝµÄ±£´æ»òÕ߶ªÊ§Çé¿öÈçºÎµÈÎÊÌâ¡£ÎÒÃÇ¿ÉÒÔͨ¹ý¼Ì³ÐÀàjava.lang.ThrowableµÄ×ÓÀࣺExceptionÀ´Éè¼ÆÎÒÃÇ×Ô¼ºµÄJavaÒì³£¡£ExceptionÀàÓÃÓÚÃèÊö³ÌÐòÄܹ»²¶»ñµÄÒì³££¬ÈçClassNotFoundException¡£Òª×¢ÒâµÄÊÇ×Ô¶¨ÒåÒì³£ÀàÖ®¼äÒ²¿ÉÒÔÓм ......
import java.util.LinkedList;
public abstract class Manager {
private String mThreadPoolName = null;
......
1. Ê×ÏÈString²»ÊôÓÚ8ÖÖ»ù±¾Êý¾ÝÀàÐÍ£¬StringÊÇÒ»¸ö¶ÔÏó¡£
¡¡¡¡ÒòΪ¶ÔÏóµÄĬÈÏÖµÊÇnull£¬ËùÒÔStringµÄĬÈÏÖµÒ²ÊÇnull£»µ«ËüÓÖÊÇÒ»ÖÖÌØÊâµÄ¶ÔÏó£¬ÓÐÆäËü¶ÔÏóûÓеÄһЩÌØÐÔ¡£
¡¡¡¡2. new String()ºÍnew String(“”)¶¼ÊÇÉêÃ÷Ò»¸öеĿÕ×Ö·û´®£¬ÊÇ¿Õ´®²»ÊÇnull£»
¡¡¡¡3. String str=”kvill”£»
......
¹¤×÷ÒѾÓаëÄêÁË£¬Í»È»Ïëдµã¶«Î÷£¬´óѧµÄʱºò¾ÍÓÐдÈռǵÄÏ°¹ß£¬µ«ÊÇ×Ô´ÓÈ¥Java06°àѧϰһֱµ½ÏÖÔÚ¹¤×÷£¬ÂýÂýµÄҲûÓÐʱ¼äȥдÈռǣ¬Ï£Íûͨ¹ýÕâƪÎÄÕÂÄÜÈÃJava˽ÛÓµÄѧµÜѧÃÃÃÇ¿´ÁËÓÐËù°ïÖú¡£
ÏàÐźܶàͬѧºÜÎÒÒ»Ñù´óËĵÄʱºò¶¼±È½ÏÃÔ㣬ÓÈÆäÊÇÎÒ¶ÁµÄ¼ÆËã»úרҵ£¬ËµÊµ»°´óѧÀïѧµÄºÍÉç»áʵ¼ÊÐèÒªµÄ» ......