<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)  編輯  收藏

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


    網站導航:
     
    主站蜘蛛池模板: 国内精品免费麻豆网站91麻豆| 一区免费在线观看| 免费无码一区二区三区| 亚洲日韩精品一区二区三区无码| 亚洲高清中文字幕免费| 在线播放高清国语自产拍免费 | 亚洲Av永久无码精品黑人| 免费人成在线观看69式小视频| 亚洲高清日韩精品第一区| 国产a视频精品免费观看| 亚洲国产精品综合福利专区| 免费成人激情视频| 亚洲人成电影在线天堂| 国产一级淫片a免费播放口之| 亚洲乱码无限2021芒果| 在线看无码的免费网站| 久久久久久a亚洲欧洲aⅴ| 国产色无码精品视频免费| 久久久久亚洲精品无码系列| 99久久人妻精品免费一区| 久久精品亚洲AV久久久无码| 岛国片在线免费观看| 免费无码国产在线观国内自拍中文字幕 | 国产亚洲av片在线观看16女人| 中文字幕在线成人免费看| 亚洲av中文无码乱人伦在线播放| 久久久久久成人毛片免费看| 亚洲人成电影福利在线播放| 国产一卡2卡3卡4卡无卡免费视频 国产一卡二卡3卡四卡免费 | 黄网站色成年片大免费高清 | 四虎影视永久免费视频观看| fc2免费人成在线| 亚洲精品线在线观看| 69成人免费视频无码专区| 杨幂最新免费特级毛片| 亚洲精品高清久久| 国产精品成人四虎免费视频| 99久久精品毛片免费播放| 亚洲av成人综合网| 亚洲性久久久影院| 免费看污成人午夜网站|