用到Java2Word.jar,可在本博客文件中下载

import com.heavenlake.wordapi.Document;
public class testWORD {
  public testWORD() {
    Document doc = null;
    try {
      doc = new Document();
      doc.open("C:/test.doc");
      doc.insert("第一章:宪政概论","正文");
      doc.insertAtBookmark("testbookm","第一章:宪政概论\n地方大幅度","正文");
      doc.insertAtBookmark("testbookm",
                           new java.io.File("D:/DOC/My Pictures/ycj_044.jpg"));
    }
    catch (Exception e) {
      e.printStackTrace();
    }
    finally {
      try {
        if(doc!=null) doc.close(true);
      }
      catch (Exception e) {
        e.printStackTrace();
      }

    }

  }

  public static void main(String[] args) {
   testWORD test1 = new testWORD();
  }

}

相关文章:

  • 2022-02-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-17
  • 2022-03-03
  • 2022-02-21
猜你喜欢
  • 2021-08-23
  • 2021-11-06
  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案