<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 閱讀(74) 評論(0)  編輯  收藏

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


    網站導航:
     
    主站蜘蛛池模板: 免费一级毛片在线播放视频| 一级一级一片免费高清| 99视频有精品视频免费观看| 亚洲国产精品无码av| 99在线免费视频| 久久久亚洲欧洲日产国码农村| 99久久免费国产精品热| 亚洲国产精品无码AAA片| 久久青草国产免费观看| 91情国产l精品国产亚洲区| 国产成人精品免费视频动漫 | 理论亚洲区美一区二区三区| 免费看美女被靠到爽的视频| 久久精品国产亚洲av天美18| 亚洲国产精品13p| 99热在线日韩精品免费| 亚洲视频网站在线观看| 18禁成年无码免费网站无遮挡| 亚洲丶国产丶欧美一区二区三区| 亚洲?V乱码久久精品蜜桃| EEUSS影院WWW在线观看免费| 亚洲国产天堂在线观看| 97人伦色伦成人免费视频| 色www免费视频| 亚洲AV无码专区电影在线观看| 全免费毛片在线播放| 国产精品亚洲精品久久精品 | 精品亚洲成α人无码成α在线观看| 中文字幕无码免费久久9一区9 | 欧洲乱码伦视频免费| 亚洲av成人片在线观看| 伊伊人成亚洲综合人网7777| 中文字幕亚洲免费无线观看日本 | 国产精品免费观看久久| 免费二级毛片免费完整视频| 亚洲国产精品久久丫| 少妇性饥渴无码A区免费 | 亚洲精品伊人久久久久| 亚洲综合久久夜AV | 曰批视频免费40分钟试看天天| 亚洲成a人无码亚洲成www牛牛|