java°Ñwordתhtml»òtxt
×î½üÏîÄ¿ÖÐÐèÒªÔÚÒ³ÃæÖÐÔ¤ÀÀwordÎļþ£¬Ëä˵word±¾Éí¾Í¿ÉÒÔÔÚÒ³ÃæÖдò¿ª£¬µ«ÊÇÓÐÁ½¸ö±×¶Ë£¬1ÊÇ¿É¿Í»§¶Ë±ØÐë°²×°word£¬ 2ÊÇ¿Í»§¶ËµÄ»·¾³ÒÔ¼°office°æ±¾ÓвîÒ죬»áÔì³ÉÔ¤ÀÀ²»Îȶ¨¡£ÔÚÍøÉÏÕÒÁËһϣ¬·¢ÏÖpoi¿ÉÒÔ°Ñword×°»»³Étxt,µ«ÊǸñʽ¶¼¶ªÁË,Ö»ÓйâͺͺµÄÎı¾,ÓÖËÑjacob, ÍøÓÑÃÇÖÚ˵·×ç¡, ×îºó»¹ÊÇ×Ô¼ºsourceforgeÉÏÏÂÔØjacob²¢ÔĶÁdoc¸ã¶¨ÁË.
1 goto http://sourceforge.net/projects/jacob-project/ and download latest library of jacob.
ÏÂÔصÄzipÎļþ½á¹¹ÈçÏÂ:
2 intel cpuµÄ»úÆ÷¿½±´jacob-1.15-M3-x86.dllµ½%JAVA_HOME%/jre/bin, AMD cpuµÄ»úÆ÷¿½±´jacob-1.15-M3-x64.dll. ²»¹ýÇëÈ·±£jreĿ¼ÊÇÄãÕýÔÚʹÓõÄjre, ÒòΪÏÖÔںܶàeclipse°æ±¾×Ô¼º´øjre. Õâ¸öÔÚeclipse windows-> preferences -> installed jres¿ÉÒԲ鿴.
3 ¿½±´jacob.jarµ½ÄãÏîĿĿ¼µÄlibÏÂÃ沢ȷ±£¼ÓÈëµ½ÁËclasspath.
×¼±¸¹¤×÷Íê±Ï, ÏÖÔÚ¾Íд³ÌÐòÁË.
import com.jacob.activeX.ActiveXComponent;
import com.jacob.com.Dispatch;
import com.jacob.com.Variant;
public class Test {
public static void main(String[] args) {
ActiveXComponent app = new ActiveXComponent("Word.Application");
app.setProperty("Visible", new Variant(false));
Dispatch doc1 = app.getProperty("Documents").toDispatch();
//´ò¿ªaaaa.doc
Dispatch doc2 = Dispatch.invoke(
doc1,
"Open",
Dispatch.Method,
new Object[]{"e:\\aaaa.doc", new Variant(false), new Variant(true)},
new int[1]
).toDispatch();
//Áí´æΪaaaa.html
Dispatch.invoke(
doc2,
"SaveAs",
Dispatch.Method,
new Object[]{
"c:\\aaaa.html",
new Variant(8)//7Ϊtxt¸ñʽ£¬ 8±£´æΪhtml¸ñʽ
},
new int[1]
);
Variant f = new Variant(false);
Dispatch.call(doc2, "Close", f);
}
}
ʹÓÃÆðÀ´ºÜ¼òµ¥.
µ±È»jacob²»¹â¿ÉÒÔ×öword to html, »¹¿ÉÒÔ×öºÜ¶àÊÂÇé:
Jacob is a Java library that lets Java applications communicate with Microsoft Windows DLLs or COM libraries. It does this through the use of a custom DLL that the Jacob Java classes communicate with via JNI. The library and dll isolate the Java developer from the underlying windows libraries so that
Ïà¹ØÎĵµ£º
import java.io.File;
public class FileTest{
public static void main(String[] args){
scan("c:/file/ss");
}
public static void scan(String path){
if(path ==null)
return ;
File file = new File(path); //É ......
Ç뿼ÂÇÏÂÃæÕâ¶Î»°ËùÃèÊöµÄÎÊÌ⣺
TomÔÚÒ»¼ÒÆû³µÅä¼þÉ̵깺ÂòÁËÒ»¸ö¼ÛÖµ$1.10µÄ»ð»¨Èû£¬µ«ÊÇËûÇ®°üÖж¼ÊÇÁ½ÃÀÔªÒ»Õŵij®Æ±¡£Èç¹ûËûÓÃÒ»ÕÅÁ½ÃÀÔªµÄ³®Æ±Ö§¸¶Õâ¸ö»ð»¨Èû£¬ÄÇôӦ¸ÃÕÒ¸øËû¶àÉÙÁãÇ®ÄØ£¿
ÏÂÃæÊÇÒ»¸öÊÔͼ½â¾öÉÏÊöÎÊÌâµÄ³ÌÐò£¬Ëü»á´òÓ¡³öʲôÄØ£¿
public class Change{
public static void main(String args[ ......
µÃÀ²£¬Ç°ÃæÄǸöÃÕÌâÊÇÓе㼬ÊÖ£¬µ«ËüÊÇÓйØÕû³ýµÄ£¬Ã¿¸öÈ˶¼ÖªµÀÕû³ýÊǺÜÂé·³µÄ¡£ÄÇôÏÂÃæµÄ³ÌÐòÖ»Éæ¼°¼Ó·¨£¬ËüÓÖ»á´òÓ¡³öʲôÄØ£¿
public class Elementary{
public static void main(String[] args){
System.out.println(12345+5432l);
}
}
´Ó±íÃæÉÏ¿´£¬ÕâÏñÊÇÒ»¸öºÜ¼òµ¥µÄÃÕÌâ——¼òµ¥µ½²»ÐèÒªÖ½ºÍ ......
HTML ¼òÊ·
HTML ÊÇ Web ͳһÓïÑÔ£¬ÕâЩÈÝÄÉÔÚ¼âÀ¨ºÅÀïµÄ¼òµ¥±êÇ©£¬¹¹³ÉÁËÈç½ñµÄ Web¡£1991 Ä꣬Tim Berners-Lee ±àдÁËÒ»·Ý½Ð×ö “HTML ±êÇ©”µÄÎĵµ£¬ÀïÃæ°üº¬ÁË´óÔ¼20¸öÓÃÀ´±ê¼ÇÍøÒ³µÄ HTML ±êÇ©¡£ËûÖ±½Ó½èÓà SGML µÄ±ê¼Ç¸ñʽ£¬Ò²¾ÍÊǺóÀ´ÎÒÃÇ¿´µ½µÄ HTML ±ê¼ÇµÄ¸ñʽ¡£±¾ÎĽ²Ê ......