heting

            BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
            40 隨筆 :: 9 文章 :: 45 評(píng)論 :: 0 Trackbacks
          <html><head>

          <script language="javascript" type="text/javascript">
                
          function MakeExcel() {

                  
          var i, j, n;

                  
          try {

                    
          var xls = new ActiveXObject("Excel.Application");

                  }


                  
          catch(e) {

                    alert( 
          "要生成該表,您必須安裝Excel電子表格軟件,同時(shí)瀏覽器須使用“ActiveX 控件”,您的瀏覽器須允許執(zhí)行控件。請(qǐng)點(diǎn)擊【幫助】了解瀏覽器設(shè)置方法!");

                      
          return "";

                  }


                  xls.visible 
          =true// 設(shè)置excel為可見

                  
          var xlBook = xls.Workbooks.Add;

                  
          var xlsheet = xlBook.Worksheets(1);

               
                  xlsheet.Cells(
          2,1).Value = "卡號(hào)";

                  xlsheet.Cells(
          2,2).Value = "密碼";

                  xlsheet.Cells(
          2,3).Value = "計(jì)費(fèi)方式";

                  xlsheet.Cells(
          2,4).Value = "有效天數(shù)";

                  xlsheet.Cells(
          2,5).Value = "金額";


                  xlsheet.Range(xlsheet.Cells(
          1,1),xlsheet.Cells(1,7)).mergecells=true;

                  xlsheet.Range(xlsheet.Cells(
          1,1),xlsheet.Cells(1,7)).value="發(fā)卡記錄";
                  
                 
                  
                  xlBook.SaveAs(
          "C:\\TEST.XLS");
                  
                  
          // 用 Application 對(duì)象用 Quit 方法關(guān)閉 Excel。
                  
                  xlBook.Application.Quit();

                  xls
          =null;

                  xlBook
          =null;

                  xlsheet
          =null;

                }


              
              
          </script>
          </head><body><input type='button' value="生成" onclick='MakeExcel()'></body></html>


          posted on 2009-11-07 12:17 賀挺 閱讀(686) 評(píng)論(0)  編輯  收藏 所屬分類: js

          只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 右玉县| 绥江县| 潞西市| 崇信县| 青川县| 青浦区| 会宁县| 金坛市| 普兰店市| 嘉禾县| 荔浦县| 子洲县| 乌苏市| 维西| 齐齐哈尔市| 四会市| 高密市| 阿城市| 苏州市| 通州区| 犍为县| 锡林浩特市| 平湖市| 册亨县| 咸丰县| 大同县| 墨竹工卡县| 临夏市| 平湖市| 忻城县| 北京市| 庆云县| 嘉峪关市| 淮北市| 永福县| 青川县| 浪卡子县| 宜兰县| 大庆市| 娄烦县| 广宗县|