Java³éÈ¡Word£¬PDFµÄËÄÖÖÎäÆ÷
ÔÚÕâÀï×ܽáһϳéÈ¡word,pdfµÄ¼¸ÖÖ·½·¨¡£
ºÜ¶àÈËÓÃjava½øÐÐÎĵµ²Ù×÷ʱ¾³£»áÓöµ½Ò»¸öÎÊÌ⣬¾ÍÊÇÈçºÎ»ñµÃword£¬excel£¬pdfµÈÎĵµµÄÄÚÈÝ£¿ÎÒÑо¿ÁËһϣ¬ÔÚÕâÀï×ܽáһϳéÈ¡word,pdfµÄ¼¸ÖÖ·½·¨¡£
1. ÓÃjacob
ÆäʵjacobÊÇÒ»¸öbridage£¬Á¬½ÓjavaºÍcom»òÕßwin32º¯ÊýµÄÒ»¸öÖмä¼þ£¬jacob²¢²»ÄÜÖ±½Ó³éÈ¡word,excelµÈÎļþ£¬ÐèÒª×Ô¼ºÐ´dllŶ£¬²»¹ýÒѾÓÐΪÄãдºÃµÄÁË£¬¾ÍÊÇjacobµÄ×÷ÕßÒ»²¢ÌṩÁË¡£
jacob jarÓëdllÎļþÏÂÔØ£º http://danadler.com/jacob/
ÏÂÔØÁËjacob²¢·Åµ½Ö¸¶¨µÄ·¾¶Ö®ºó(dll·Åµ½path,jarÎļþ·Åµ½classpath)£¬¾Í¿ÉÒÔдÄã×Ô¼ºµÄ³éÈ¡³ÌÐòÁË£¬ÏÂÃæÊÇÒ»¸ö¼òµ¥µÄÀý×Ó£º
import java.io.File;
import com.jacob.com.*;
import com.jacob.activeX.*;
/**
* Title: pdf extraction
* Description: email:chris@matrix.org.cn
* Copyright: Matrix Copyright (c) 2003
* Company: Matrix.org.cn
* @author chris
* @version 1.0,who use this example pls remain the declare
*/
public class FileExtracter{
public static void main(String[] args) {
ActiveXComponent component = new ActiveXComponent("Word.Application");
String inFile = "c:\\test.doc";
String tpFile = "c:\\temp.htm";
String otFile = "c:\\temp.xml";
boolean flag = false;
try {
component.setProperty("Visible", new Variant(false));
Object wordacc = component.getProperty("document£®").toDispatch();
Object wordfile = Dispatch.invoke(wordacc,"Open", Dispatch.Method,
new Object[]{inFile,new Variant(false), new Variant(true)},
new int[1] )
Ïà¹ØÎĵµ£º
ʵÏÖ²½Ö裺
1.×Ô¶¨ÒåÒ»¸öJavaÀ࣬¸ÃJavaÀàÖж¨ÒåÒ»¸ö·½·¨À´°üº¬ÐèÒª±»ÔËÐеĴúÂë¡£
2.¶¯Ì¬±àÒë¸Õ¸ÕÉú³ÉµÄJavaÔ´Â룬²»ÔÚ´ÅÅÌÉÏÉú³ÉÔ´Â룬¶øÊÇÖ±½Ó±àÒëÄÚ´æÖеÄJavaÔ´Âë¡£
3.¶¯Ì¬¼ÓÔØ¸Õ¸Õ´´½¨±àÒëµÄJava¶þ½øÖÆÂ룬±àÒëºÃµÄJava¶þ½øÖÆÂë²»ÊÇÔÚ´ÅÅÌÉÏ£¬¶øÊÇ·ÅÔÚÄÚ´æÖУ¬²¢¶¨Òå×Ô¼ºµÄÀà¼ÓÔØÆ÷£¬¸ºÔð¼ÓÔØÄÚ´æÖеÄclassÎļþ¡£
......
JAVA³ÌÐò·´±àÒ빤¾ß
ÏÂÔØµØÖ·£ºhttp://java.decompiler.free.fr/?q=jdgui
JD-GUI
JD-GUI is a standalone graphical utility that displays Java source codes of “.class” files. You can browse the reconstructed source code with the JD-GUI for instant access to methods and fields.
JD-GUI is fre ......
Map map = new HashMap();
Iterator iter = map.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry entry = (Map.Entry) iter.next();
Object key = entry.getKey();
Object val = entry.getValue();
}
......
Èç¹û×Ô¼ºµÄjava projectÖÐÐèÒªÒýÓöîÍâµÄjar°ü×÷Ϊ×ÊÔ´Îļþ£¬ÄÇôÐèÒª×Ô¶¨ÒåÅäÖÃÎļþMANIFEST.MF ,ÀýÈ磺
Manifest-Version: 1.0
Class-Path: lib\crimson.jar lib\jbcl.jar lib\junit.jar lib\log4j-1.2.13.jar lib\mysql-connector-java-3.1.13-bin.jar
Main-Class: src.YourMainClassName
ÆäÖеÄClass-Path¾ÍÖ¸¶¨ÁËÍ ......