<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片视频WWW| 国产亚洲精品a在线观看| 精品视频在线免费观看| 日韩毛片免费在线观看| 亚洲精品乱码久久久久久V | 四虎免费影院4hu永久免费| 在线观看亚洲AV日韩A∨| 毛片免费在线视频| 亚洲国产精品无码中文lv | 亚洲国产综合精品一区在线播放| 亚洲精品无码专区在线播放| 韩国二级毛片免费播放| 色偷偷亚洲男人天堂| 成人亚洲网站www在线观看| 免费播放国产性色生活片| 国产成人亚洲综合无码| 中文字幕无码毛片免费看| 久久亚洲AV无码精品色午夜麻| 日本免费一区二区久久人人澡| 亚洲日本中文字幕区| 国产精品怡红院永久免费| 亚洲午夜理论片在线观看| 日本高清色本免费现在观看| 免费观看四虎精品成人| 亚洲国产成人一区二区三区| 久草视频在线免费看| 狠狠色伊人亚洲综合网站色| 国产高清视频在线免费观看| 猫咪免费观看人成网站在线| 亚洲午夜国产精品无码| **aaaaa毛片免费同男同女| 亚洲人成欧美中文字幕| 亚洲美女在线国产| 久久精品一本到99热免费| 亚洲综合激情五月色一区| yy6080久久亚洲精品| 91在线老王精品免费播放| 亚洲日韩国产二区无码| 亚洲综合无码精品一区二区三区| 一区二区三区四区免费视频|