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

        var i, j, n;

        try {

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

        }

        catch(e) {

          alert( "要生成该表,您必须安装Excel电子表格软件,同时浏览器须使用“ActiveX 控件”,您的浏览器须允许执行控件。请点击【帮助】了解浏览器设置方法!");

            return "";

        }

        xls.visible =true; // 设置excel为可见

        var xlBook = xls.Workbooks.Add;

        var xlsheet = xlBook.Worksheets(1);

    
        xlsheet.Cells(2,1).Value = "卡号";

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

        xlsheet.Cells(2,3).Value = "计费方式";

        xlsheet.Cells(2,4).Value = "有效天数";

        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="发卡记录";
       
      
       
        xlBook.SaveAs("C:\\TEST.XLS");
       
        // 用 Application 对象用 Quit 方法关闭 Excel。
       
        xlBook.Application.Quit();

        xls=null;

        xlBook=null;

        xlsheet=null;

      }

   
    </script>

posted on 2008-04-11 23:58  Stym--闫生  阅读(877)  评论(0编辑  收藏  举报