<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)航:
     
    主站蜘蛛池模板: 国产成人亚洲综合无码精品| 18勿入网站免费永久| 免费在线观看中文字幕| 久操免费在线观看| 国外亚洲成AV人片在线观看| 曰批全过程免费视频观看免费软件| 毛片网站免费在线观看| 在线观看亚洲AV日韩A∨| 国产美女在线精品免费观看| 亚洲欧洲日本在线观看| 精品国产麻豆免费网站| mm1313亚洲国产精品无码试看| 国产jizzjizz视频全部免费| 男女猛烈激情xx00免费视频| 亚洲一区精品伊人久久伊人| 中文字幕免费视频精品一| 精品亚洲综合久久中文字幕| 99视频在线免费| 亚洲av无码一区二区三区观看| 香蕉97碰碰视频免费| 亚洲免费无码在线| 国精产品一区一区三区免费视频 | 两个人的视频高清在线观看免费| 亚洲国产精品综合久久久| 毛片免费观看网站| free哆拍拍免费永久视频| 日日麻批免费40分钟日本的| 亚洲精品人成网在线播放影院| 国产成人免费高清在线观看| 亚洲的天堂av无码| 在线观看免费成人| 亚洲国产精品人久久电影| 成年轻人网站色免费看| 一级黄色片免费观看| 国产精品无码一二区免费 | 青青青国产免费一夜七次郎| 日韩久久无码免费毛片软件| 亚洲自偷自偷精品| 久章草在线精品视频免费观看| 亚洲偷偷自拍高清| 国产亚洲精品成人AA片新蒲金 |