<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)航:
     
    主站蜘蛛池模板: 全部免费毛片在线| 99久久久国产精品免费无卡顿| 无人在线观看完整免费版视频| 久久久久亚洲av无码专区导航 | 亚洲JIZZJIZZ妇女| 亚洲视频免费在线看| 日本特黄特色免费大片| 四虎影视在线永久免费看黄| 亚洲国产第一站精品蜜芽| 思思久久99热免费精品6| 亚洲av区一区二区三| 亚洲精品V天堂中文字幕| 在线播放高清国语自产拍免费| 在线精品亚洲一区二区| 日韩精品视频免费观看| 日韩亚洲翔田千里在线| 亚洲欧洲久久av| 香蕉免费一级视频在线观看| 亚洲AV无码精品色午夜果冻不卡 | 亚洲色图在线播放| 羞羞网站免费观看| 亚洲第一黄色网址| 亚洲狠狠狠一区二区三区| 一本岛高清v不卡免费一三区| 亚洲香蕉在线观看| 凹凸精品视频分类国产品免费| 特级毛片全部免费播放a一级| 自拍偷自拍亚洲精品第1页| 无码精品国产一区二区三区免费| 久久久久亚洲AV无码观看| 成人影片麻豆国产影片免费观看| 国产成人亚洲综合a∨| 国产亚洲一区二区三区在线观看| 91精品免费不卡在线观看| 亚洲色欲色欲www在线播放| 亚洲无码视频在线| h片在线免费观看| 免费视频精品一区二区| 91在线亚洲精品专区| 国产v片免费播放| 在线观看免费中文视频|