ÀûÓÃjava¶ÁÈ¡ExcelÖеÄÊý¾Ý
ʹÓÃWindows²Ù×÷ϵͳµÄÅóÓѶÔExcel£¨µç×Ó±í¸ñ£©Ò»¶¨²»»áÄ°Éú£¬µ«ÊÇҪʹÓÃJavaÓïÑÔÀ´²Ù×ÝExcelÎļþ²¢²»ÊÇÒ»¼þÈÝÒ×µÄÊ¡£ÔÚWebÓ¦ÓÃÈÕÒæÊ¢ÐеĽñÌ죬ͨ¹ýWebÀ´²Ù×÷ExcelÎļþµÄÐèÇóÔ½À´Ô½Ç¿ÁÒ£¬Ä¿Ç°½ÏΪÁ÷ÐеIJÙ×÷ÊÇÔÚJSP»òServlet Öд´½¨Ò»¸öCSV £¨comma separated values£©Îļþ£¬²¢½«Õâ¸öÎļþÒÔMIME£¬text/csvÀàÐÍ·µ»Ø¸øä¯ÀÀÆ÷£¬½Ó×Åä¯ÀÀÆ÷µ÷ÓÃExcel²¢ÇÒÏÔʾCSVÎļþ¡£ÕâÑùÖ»ÊÇ˵¿ÉÒÔ·ÃÎʵ½ExcelÎļþ£¬µ«ÊÇ»¹²»ÄÜÕæÕýµÄ²Ù×ÝExcelÎļþ£¬±¾ÎĽ«¸ø´ó¼ÒÒ»¸ö¾ªÏ²£¬Ïò´ó¼Ò½éÉÜÒ»¸ö¿ª·ÅÔ´ÂëÏîÄ¿——Java Excel API£¬Ê¹ÓÃËü´ó¼Ò¾Í¿ÉÒÔ·½±ãµØ²Ù×ÝExcelÎļþÁË¡£
JAVA EXCEL API¼ò½é
Java ExcelÊÇÒ»¿ª·ÅÔ´ÂëÏîÄ¿£¬Í¨¹ýËüJava¿ª·¢ÈËÔ±¿ÉÒÔ¶ÁÈ¡ExcelÎļþµÄÄÚÈÝ¡¢´´½¨ÐµÄExcelÎļþ¡¢¸üÐÂÒѾ´æÔÚµÄExcelÎļþ¡£Ê¹ÓøÃAPI·ÇWindows²Ù×÷ϵͳҲ¿ÉÒÔͨ¹ý´¿JavaÓ¦ÓÃÀ´´¦ÀíExcelÊý¾Ý±í¡£ÒòΪÊÇʹÓÃJava±àдµÄ£¬ËùÒÔÎÒÃÇÔÚWebÓ¦ÓÃÖпÉÒÔͨ¹ýJSP¡¢ServletÀ´µ÷ÓÃAPIʵÏÖ¶ÔExcelÊý¾Ý±íµÄ·ÃÎÊ¡£
ÏÖÔÚ·¢²¼µÄÎȶ¨°æ±¾ÊÇV2.0£¬ÌṩÒÔϹ¦ÄÜ£º
· ´ÓExcel 95¡¢97¡¢2000µÈ¸ñʽµÄÎļþÖжÁÈ¡Êý¾Ý£»
· ¶ÁÈ¡Excel¹«Ê½£¨¿ÉÒÔ¶ÁÈ¡Excel 97ÒÔºóµÄ¹«Ê½£©£»
· Éú³ÉExcelÊý¾Ý±í£¨¸ñʽΪExcel 97£©£»
· Ö§³Ö×ÖÌå¡¢Êý×Ö¡¢ÈÕÆڵĸñʽ»¯£»
· Ö§³Öµ¥Ôª¸ñµÄÒõÓ°²Ù×÷£¬ÒÔ¼°ÑÕÉ«²Ù×÷£»
· ÐÞ¸ÄÒѾ´æÔÚµÄÊý¾Ý±í£»
· ÏÖÔÚ»¹²»Ö§³ÖÒÔϹ¦ÄÜ£¬µ«²»¾Ã¾Í»áÌṩÁË£º
· ²»Äܹ»¶Áȡͼ±íÐÅÏ¢£»
¿ÉÒÔ¶Á£¬µ«ÊDz»ÄÜÉú³É¹«Ê½£¬ÈκÎÀàÐ͹«Ê½×îºóµÄ¼ÆËãÖµ¶¼¿ÉÒÔ¶Á³ö£»
Ó¦ÓÃʾÀý
´ÓExcelÎļþ¶ÁÈ¡Êý¾Ý±í
Java Excel API¼È¿ÉÒÔ´Ó±¾µØÎļþϵͳµÄÒ»¸öÎļþ(.xls)£¬Ò²¿ÉÒÔ´ÓÊäÈëÁ÷ÖжÁÈ¡ExcelÊý¾Ý±í¡£¶ÁÈ¡ExcelÊý¾Ý±íµÄµÚÒ»²½ÊÇ´´½¨Workbook(ÊõÓ¹¤×÷±¡)£¬ÏÂÃæµÄ´úÂëƬ¶Î¾ÙÀý˵Ã÷ÁËÓ¦¸ÃÈçºÎ²Ù×÷£º(ÍêÕû´úÂë¼ûExcelReading.java)
import java.io.*;
import jxl.*;
… … … …
try
{
//¹¹½¨Workbook¶ÔÏó, Ö»¶ÁWorkbook¶ÔÏó
//Ö±½Ó´Ó±¾µØÎļþ´´½¨Workbook
//´ÓÊäÈëÁ÷´´½¨Workbook
InputStream is = new FileInputStream(sourcefile);
jxl.Workbook rwb = Workbook.getWorkbook(is);
}
catch (Exception e)
{
e.printStackTrace();
}
Ò»µ©´´½¨ÁËWorkbook£¬ÎÒÃǾͿÉÒÔͨ¹ýËüÀ´·ÃÎÊExcel Sheet(ÊõÓ¹¤×÷±í)¡£²Î¿¼ÏÂÃæµÄ´úÂëƬ¶Î£
Ïà¹ØÎĵµ£º
2008 Äê 6 ÔÂ 24 ÈÕ
ÔÎĵØÖ·£º http://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0806wangys/
±¾ÎĽéÉÜ IBM FileNet P8 4.0 Platform ÌṩµÄ Content Java API¡£Ê×ÏÈ¶Ô FileNet P8 Content Engine ºÍ API ½øÐиÅÒª½éÉÜ, ²¢ËµÃ÷ÁËһЩ»ù±¾¸ÅÄËæºóÏêϸ½éÉÜÁË FileNet Content EngineÌṩµÄ»ùÓÚ EJB ......
JAVAµÄ¿çƽ̨µÄÌØÐÔÉîÊÜjava³ÌÐòÔ±ÃǵÄϲ°®,µ«ÕýÊÇÓÉÓÚËüΪÁËʵÏÖ¿çƽ̨µÄÄ¿µÄ,ʹµÃËüºÍ±¾µØ»úÆ÷µÄ¸÷ÖÖÄÚ²¿ÁªÏµ±äµÃºÜÉÙ,´ó´óÔ¼ÊøÁËËüµÄ¹¦ÄÜ,±ÈÈçÓëһЩӲ¼þÉ豸ͨÐÅ,ÍùÍùÒª»¨·ÑºÜ´óµÄ¾«Á¦È¥Éè¼ÆÁ÷³Ì±àд´úÂëÈ¥¹ÜÀíÉ豸¶Ë¿Ú,¶øÇÒÓÐһЩÉ豸³§ÉÌÌṩµÄÓ²¼þ½Ó¿ÚÒѾ¾¹ýÒ»¶¨µÄ·â×°ºÍ´¦Àí,²»ÄÜÖ±½ÓʹÓÃjava³ÌÐòͨ¹ý¶Ë¿ÚºÍÉè± ......
String ×Ö·û´®³£Á¿
StringBuffer ×Ö·û´®±äÁ¿£¨Ḭ̈߳²È«£©
StringBuilder ×Ö·û´®±äÁ¿£¨·ÇḬ̈߳²È«£©
¼òÒªµÄ˵£¬ String ÀàÐÍºÍ StringBuffer ÀàÐ͵ÄÖ÷ÒªÐÔÄÜÇø±ðÆäʵÔÚÓÚ String ÊDz»¿É±äµÄ¶ÔÏó, Òò´ËÔÚÿ´Î¶Ô String ÀàÐͽøÐиıäµÄʱºòÆäʵ¶¼µÈͬÓÚÉú³ÉÁËÒ»¸öÐ嵀 String ¶ÔÏó£¬È»ºó½«Ö¸ÕëÖ¸ÏòÐ嵀 String ¶ÔÏó£¬ËùÒÔ¾ ......
Ç°Ìì°øÍíÎÒ·¢±íÁË¡¶JavaµÄ¿çƽ̨¾ÍÊÇÒ»¾ä»ÑÑÔ¡£¡·£¬Ô±¾¾ÍÊÇÖÜÄ©ÏÐÀ´ÎÞÊ£¬·¢±íһƪÂÔ´øÕùÒéÐԵIJ©ÎÄÈôó¼Ò¶¼À´³³³³¼Ü£¬·¢±í×Ô¼ºµÄ¿´·¨£¬¸ù±¾¾ÍûÏë×ÅË°ÑË´òµ¹£¬Ò»¸öÐÐÒµ»òÕßÊǼ¼ÊõÕóÓªÊÇÎÞ·¨ÓöÌÆÚ¿ÚË®ÕÌ´òµ½¶ÔÊֵģ¬¶øÇÒÎÞÂÛ˵¹Á˶ÔË«·½ÕóÓªµÄ·ÛË¿ÃÇÒ²ÊÇÓк¦ÎÞÒæ¡£
ÎҸоõ¿ÉÒÔ¶¥µ½50Â¥£¬³öºõÒâÁϵÄÊÇ´ó¼Ò¾ÓÈ»·×·×д³ö ......
import java.io.File;
import java.io.FileNotFoundException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class ResolveXmlFile {
public void resolverXml() throws DocumentException, FileNotFoundExcept ......