首页 > Web开发 > 详细

【JS】打印Excel——ActiveX控件

时间:2015-09-27 06:21:19      阅读:309      评论:0      收藏:0      [点我收藏+]
 1 function viewToExcel(){
 2         var filepath = "f:\\PrinterExcel.xls";
 3         var xlApp;
 4         var xlBook;
 5         var xlSheet;
 6         try {  
 7             xlApp = new ActiveXObject("Excel.Application");  
 8         }  
 9         catch (e) {  
10             alert("请调整IE安全选项");
11             return;  
12         }
13         xlBook = xlApp.Workbooks.Open(filepath);
14         
15         xlSheet = xlBook.ActiveSheet;
16         xlSheet.Cells(1,1).value="新乡";
17         xlSheet.Cells(5,2).value="郑斌";
18         xlSheet.Cells(3,5).value="2015";
19         xlSheet.Cells(3,7).value="9";
20         xlSheet.Cells(3,8).value="27";
21         xlSheet.Cells(3,17).value="17408";
22         xlSheet.Cells(11,13).value="王泰隆";
23         
24         alert("1");
25         xlBook.PrintOut;
26         xlBook.Close(true);
27     }

 

【JS】打印Excel——ActiveX控件

原文:http://www.cnblogs.com/zhengbin/p/4841736.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!