Java¶ÁÈ¡PDF,DocµÄ·½·¨
ºÜ¶àÈËÎʵ½ÈçºÎ³éÈ¡word£¬excel£¬pdf°¢¡£ÕâÀïÎÒ×ܽáһϳéÈ¡word,pdfµÄ
¼¸ÖÖ·½·¨¡£
1¡£ÓÃjacob.
ÆäʵjacobÊÇÒ»¸öbridage£¬Á¬½ÓjavaºÍcom»òÕßwin32º¯ÊýµÄÒ»¸öÖмä¼þ£¬jacob²¢²»ÄÜÖ±½Ó³éÈ¡word,excelµÈÎļþ£¬ÐèÒª×Ô¼ºÐ´dllŶ£¬²»¹ýÒѾÓÐΪÄãдºÃµÄÁË£¬¾ÍÊÇjacobµÄ×÷ÕßÒ»²¢ÌṩÁË¡£
jacobÏÂÔØ£ºhttp://www.matrix.org.cn/down_view.asp?id=13
ÏÂÔØÁËjacob²¢·Åµ½Ö¸¶¨µÄ·¾¶Ö®ºó(dll·Åµ½path,jarÎļþ·Åµ½classpath)£¬¾Í¿ÉÒÔдÄã×Ô¼ºµÄ³éÈ¡³ÌÐòÁË£¬ÏÂÃæÊÇÒ»¸öÀý×Ó£º
import java.io.File;
import com.jacob.com.*;
import com.jacob.activeX.*;
public class FileExtracter{
public static void main(String[] args) {
ActiveXComponent app = new ActiveXComponent("Word.Application");
String inFile = "c:\\test.doc";
String tpFile = "c:\\temp.htm";
String otFile = "c:\\temp.xml";
boolean flag = false;
try {
app.setProperty("Visible", new Variant(false));
Object docs = app.getProperty("Documents").toDispatch();
Object doc = Dispatch.invoke(docs,"Open", Dispatch.Method, new Object[]{inFile,new Variant(false), new Variant(true)}, new int[1]).toDispatch();
Dispatch.invoke(doc,"SaveAs", Dispatch.Method, new Object[]{tpFile,new Variant(8)}, new int[1]);
Variant f = new Variant(false);
Dispatch.call(doc, "Close", f);
flag = true;
} catch (Exception e) {
e.printStackTrace();
} finally {
app.invoke("Quit", new Variant[] {});
}
}
}
2¡£ÓÃapacheµÄpoiÀ´³éÈ¡word£¬excel¡£
poiÊÇapacheµÄÒ»¸öÏîÄ¿£¬²»¹ý¾ÍËãÓÃpoiÄã¿ÉÄܶ¼¾õµÃºÜ·³£¬²»¹ý²»Òª½ô£¬ÕâÀïÌṩÁ˸ü¼Ó¼òµ¥µÄÒ»¸ö½Ó¿Ú¸øÄ㣺
ÏÂÔؾ¹ý·â×°ºóµÄpoi°ü£ºhttp://www.matrix.org.cn/down_view.asp?id=14
ÏÂÔØÖ®ºó£¬·Åµ½ÄãµÄclasspath¾Í¿ÉÒÔÁË£¬ÏÂÃæÊÇÈçºÎʹÓÃËüµÄÒ»¸öÀý×Ó£º
import java.io.*;
import org.textmining.text.extraction.WordExtractor;
/**
* <p>Title: pdf extraction</p>
* <p>Description: email:chris@matrix.org.cn</p>
* <p>Copyright: Matrix Copyright (c) 2003</p>
* <p>Company: Matrix.org.cn</p>
* @author chris
* @version 1.0,who use this example pls remain the declare
*/
Ïà¹ØÎĵµ£º
ÎÒÃÇÔÚjspÒ³ÃæÉϵÄjs½Å±¾ÖпÉÒÔµ÷ÑÐjava´úÂ룬±ÈÈ磬ÎÒÃÇÐèÒªÔÙjsÖÐÓÃalertº¯ÊýÏÔʾ·þÎñÆ÷¶Ë·¢Ë͹ýÀ´µÄij¸ö×Ö·û´®ÄÇôÎÒÃÇ¿ÉÒÔÕâÑù×ö
tomcat주
ÔÚ·þÎñÆ÷¶ËÎÒÃÇÓÐrequest.setAttribute("name","abc");
ÄÇôÎÒÒªÔÚÒ³ÃæÉÏÓÃalertÏÔʾµÄ»°£¬ÓÐÁ½ÖÖ·½Ê½£º
1¡¢Ê¹ÓÃEL±í´ïʽ
ÔÚEl±í´ïʽµÄÍâÃæÓÃÒýºÅ¼´¿É£º
<scri ......
1.²ð·Ö×Ö·û´®
Óöµ½ÌØÊâ×Ö·û£¬±ÈÈ磺¶Ô‘$’·ûºÅ£¬¾ÍÓ¦¸ÃʹÓÑ\\$’£¬ºó×ܽá¿ÉÒÔ¼Ó¸ö·½À¨ºÅÈç "[.]"¡£
2.±éÀúHASHMAP
Iterator itr = map.keySet().itrator();
while(itr.hasNext())
{
Object temp1 = itr.next();
Object temp2 = tab.get(temp1);
}
......
¶ÔÏó³Ö¾Ã»¯£¬Ò²¾ÍÊÇ¿ÉÒÔ°ÑÕâ¸ö¶ÔÏóÓÀÔ¶µÄ±£´æÆðÀ´£¬ÕâÀïµÄ±£´æ²»½öÊǶÔÏó±¾Éí£¬»¹°üÀ¨ËûµÄÊôÐÔºÍËùÒÀÀµµÄÆäËûÀࡣͨ³££¬¶ÔÏó¿ÉÒԳ־û¯µ½Îļþ»òÕßÊÇÊý¾Ý¿âÖС£ÎÒÕâÀïÖ»½éÉÜÈçºÎ½«¶ÔÏó´æ´¢µ½Êý¾Ý¿âÖС£Ç¡ÇÉOracleÊý¾Ý¿âΪÎÒÃÇÌṩÁËÕâÑùµÄ·½±ã¡£
ÔÚOracleÖУ¬ÓÐÒ»ÖÖblogµÄ×Ö¶ÎÀàÐÍ£¬ËüÊÇÓÃÀ´´æ´¢´óÁ¿µÄ¶ ......
Ðí¶àʱºòÎÒÃÇÐèÒªÓõ½Ïß³Ì ±ÈÈçÏ£ÍûÒ»¸ö¸½¼ÓµÄ¹¦ÄÜ ²»ÒªÓ°ÏìÕû¸öÁ÷³ÌµÄ¹¦ÄÜ£¬±ÈÈçij¸öÁ÷³ÌÐèÒª¼ÓÈëÈÕÖ¾£¬µ«ÊDz»Ï£Íû¼Ç¼ÈÕÖ¾µÄ¹¦ÄÜÓ°ÏìÕû¸öÁ÷³ÌµÄÐÔÄÜ£¬²»ÄÜÒòΪ¼Ç¼ÈÕÖ¾°ÑÕû¸öÁ÷³Ì¸ø¿¨×¡ÁË¡£ÔÚÕâ¸öÖÖÇé¿öÏ£¬ÎÒÃÇÐèҪʹÓÃÏ̡߳£ÈüǼÈÕÖ¾ÔÚµ¥¶ÀÒ»¸öÏß³ÌÀïÃæÅÜ£¬¾Í²»»áÓ°Ï춼ÆäËûÁ÷³ÌÁË¡£
  ......
ÔÚjavaÖÐÒª¶ÁÈ¡pdfÎļþÄÚÈÝ£¬ÎÒÃÇ¿ÉÒÔ½èÖúµÚÈý·½Èí¼þʵÏÖ¡£³£ÓõÄÊÇxpdf£¬±¾Îľͼòµ¥½éÉÜÔÚlinuxÏÂÈçºÎ°²×°xpdf£¬¼°ÔÚjavaÖÐÈçºÎÀûÓÃxpdf¶ÁÈ¡pdfÎļþÄÚÈÝ¡£
Ò».°²×°xpdf
ÔÚfcϵÁÐÏ£¬²»Óð²×°£¬¿ÉÒÔÖ±½Óyum£¬µ«ÊDZÊÕß½¨Ò黹ÊÇÏÂÔØ°²×°µÄºÃ£¬ÒòΪ±ÊÕßÔø¾Åöµ½¹ýÕâÑùµÄÎÊÌ⣬¿Í»§·þÎñ ......