隨筆 - 100  文章 - 50  trackbacks - 0
          <2025年6月>
          25262728293031
          1234567
          891011121314
          15161718192021
          22232425262728
          293012345

          常用鏈接

          留言簿(3)

          隨筆分類

          隨筆檔案

          文章分類

          文章檔案

          收藏夾

          我收藏的一些文章!

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

          jcom打印 /Files/jlin/jcom224.rar

          Setup

          Extract "jcom222.zip". And copy jcom.jar and jcom.dll to the following directories
          jcom.dll -> (java.home)/bin/
          jcom.jar -> (java.home)/lib/ext/
          make sure the JAVA_HOME evironmental variable has been set, ie.
          (java.home) == java.lang.System.getProperty("java.home");

          import jp.ne.so_net.ga2.no_ji.jcom.ReleaseManager;
          import jp.ne.so_net.ga2.no_ji.jcom.excel8.ExcelApplication;
          import jp.ne.so_net.ga2.no_ji.jcom.excel8.ExcelWorkbook;
          import jp.ne.so_net.ga2.no_ji.jcom.excel8.ExcelWorkbooks;
          import jp.ne.so_net.ga2.no_ji.jcom.excel8.ExcelWorksheet;

          public class JCom {

           public boolean print(String fname) {
            ReleaseManager rm = new ReleaseManager();
            try {
             ExcelApplication excel = new ExcelApplication(rm);

             ExcelWorkbooks xlBooks = excel.Workbooks();
             ExcelWorkbook xlBook = xlBooks.Open(fname);
             ExcelWorksheet xlSheet = excel.ActiveSheet();

             xlSheet.PrintOut();

             xlBook.Close(false, null, false);
             excel.Quit();
            } catch (Exception e) {
             e.printStackTrace();
             return false;
            } finally {
             rm.release();
            }
            return true;
           }

           public static void main(String[] args) {
            JCom test = new JCom();

            try {
             //test.p
             test.print("d:/test.xls");
             
            } catch (Exception e) {
             e.printStackTrace();
            }
           }
          }

          posted on 2009-04-15 16:36 fly 閱讀(482) 評論(0)  編輯  收藏 所屬分類: java學習
          主站蜘蛛池模板: 秦安县| 建平县| 通河县| 富宁县| 夹江县| 怀宁县| 信宜市| 康平县| 巩留县| 九寨沟县| 桐乡市| 潜江市| 南华县| 万盛区| 北辰区| 和龙市| 仁化县| 揭西县| 江津市| 萍乡市| 闵行区| 武邑县| 房产| 灵台县| 夏津县| 霍林郭勒市| 光山县| 武宁县| 尼勒克县| 阿瓦提县| 莒南县| 肃北| 德江县| 西青区| 社旗县| 凤冈县| 册亨县| 镇巴县| 泽库县| 乐至县| 班玛县|