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

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


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: A片在线免费观看| 亚洲国产成人手机在线观看| av电影在线免费看| 吃奶摸下高潮60分钟免费视频| 亚洲五月综合缴情婷婷| 五月婷婷综合免费| 亚洲一区二区三区高清不卡 | 四虎成人精品国产永久免费无码| 国产午夜影视大全免费观看| 人人狠狠综合久久亚洲| 亚洲精品高清在线| 一级做a爰片久久毛片免费看| 最新国产AV无码专区亚洲| 免费无码一区二区三区蜜桃| 久久精品国产亚洲av麻| 2021在线永久免费视频| 33333在线亚洲| 国产免费午夜a无码v视频| 一本到卡二卡三卡免费高| 亚洲成a人片77777kkkk| 免费观看激色视频网站bd| 亚洲精品国产摄像头| 国产免费午夜a无码v视频| 国产免费阿v精品视频网址| 久久亚洲精品成人无码网站| 久久久久国色AV免费观看性色 | 亚洲an日韩专区在线| 男女交性永久免费视频播放| 一级中文字幕免费乱码专区| 亚洲va国产va天堂va久久| 37pao成人国产永久免费视频| 亚洲日本一线产区和二线产区对比| 免费一级黄色毛片| 欧洲人免费视频网站在线| 亚洲国产熟亚洲女视频| 亚洲午夜无码片在线观看影院猛| 永久免费不卡在线观看黄网站| 亚洲天堂2016| 亚洲伊人成无码综合网| 国产精品免费网站| kk4kk免费视频毛片|