<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 495,  comments - 11,  trackbacks - 0

      參考:

      http://danadler.com/jacob/
      http://jakarta.apache.org/poi/
      http://www.onjava.com/pub/a/onjava/2003/01/22/poi.html
      http://www.csdn.net/develop/article/15/15311.shtm
      http://forum.java.sun.com/thread.jsp?forum=40&thread=382666&tstart=0&trange=15

      Java Excel API 文檔

      http://www.andykhan.com/jexcelapi/

      1、一個jacob操作Word的例子,其他操作excel,pdf的sample里都有

      import java.io.File;
      import com.jacob.com.*;
      import com.jacob.activeX.*;
      public class WordTest {
      
       public static void main(String[] args) {
         WordBean word=new WordBean();
         word.openWord(true);
         word.createNewDocument();
         word.insertText("Hello word.");
       }
      }

      import com.jacob.activeX.*;
      import com.jacob.com.*;
      public class WordBean extends java.awt.Panel
      {
       private ActiveXComponent MsWordApp = null;
       private Dispatch document = null;
       public WordBean()
       {
         super();
       }
       public void openWord(boolean makeVisible)
       {
      //Open Word if we've not done it already
         if (MsWordApp == null)
         {
           MsWordApp = new ActiveXComponent("Word.Application");
         }
      //Set the visible property as required.
         Dispatch.put(MsWordApp, "Visible",
                new Variant(makeVisible));
       }
       public void createNewDocument()
       {
      //Find the Documents collection object maintained by Word
         Dispatch documents =
             Dispatch.get(MsWordApp,"Documents").toDispatch();
      //Call the Add method of the Documents collection to create
      //a new document to edit
         document = Dispatch.call(documents,"Add").toDispatch();
       }
       public void insertText(String textToInsert)
       {
      // Get the current selection within Word at the moment. If
      // a new document has just been created then this will be at
      // the top of the new doc
         Dispatch selection =
             Dispatch.get(MsWordApp,"Selection").toDispatch();
      //Put the specified text at the insertion point
         Dispatch.put(selection,"Text",textToInsert);
       }
       public void saveFileAs(String filename)
       {
         Dispatch.call(document,"SaveAs",filename);
       }
       public void printFile()
       {
      //Just print the current document to the default printer
         Dispatch.call(document,"PrintOut");
       }
       public void closeDocument()
       {
      // Close the document without saving changes
      // 0 = wdDoNotSaveChanges
      // -1 = wdSaveChanges
      // -2 = wdPromptToSaveChanges
         Dispatch.call(document, "Close", new Variant(0));
         document = null;
       }
       public void closeWord()
       {
         Dispatch.call(MsWordApp,"Quit");
         MsWordApp = null;
         document = null;
       }
      }

    posted on 2007-05-30 01:10 jadmin 閱讀(75) 評論(0)  編輯  收藏

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
    主站蜘蛛池模板: 一级黄色免费网站| 亚洲一本到无码av中文字幕| 无忧传媒视频免费观看入口| 免费的涩涩视频在线播放| 亚洲中文字幕久久精品无码VA| 国产高清不卡免费在线| 亚洲制服丝袜一区二区三区| 4虎1515hh永久免费| 亚洲人成在线免费观看| 插B内射18免费视频| 亚洲风情亚Aⅴ在线发布| 国产精品免费电影| 日本永久免费a∨在线视频| 亚洲精品国精品久久99热| 国产精品1024在线永久免费| 亚洲中文字幕无码日韩| 久久久久国产精品免费看| 18亚洲男同志videos网站| 91九色精品国产免费| 亚洲色大成WWW亚洲女子| 国产成人精品123区免费视频| 免费人成网上在线观看| 亚洲AV无码日韩AV无码导航| 精品免费人成视频app| 亚洲欧洲日韩国产一区二区三区| 国产女高清在线看免费观看| 9久热精品免费观看视频| 亚洲综合无码一区二区| 成年女人免费碰碰视频| 春意影院午夜爽爽爽免费| 亚洲国产精品第一区二区| 免费观看成人毛片a片2008| 另类小说亚洲色图| 亚洲处破女AV日韩精品| 天天天欲色欲色WWW免费| 一级成人a做片免费| 亚洲精品视频观看| 四虎国产精品免费久久影院| 色欲A∨无码蜜臀AV免费播| 亚洲AV日韩综合一区| 亚洲成人动漫在线|