<SCRIPT LANGUAGE='JavaScript'> <!-- var xlCenter=-4108; var xlbottom=-4107; var xlRight=-4152; var oSheet; var oActiveSheet; var oApplication;//初始化Excel对象try { oApplication = new ActiveXObject ( 'Excel.Application' ); }catch(e) { alert('您必须安装Excel电子表格软件,同时浏览器须使用“ActiveX 控件”!'); return ''; } oApplication.visible = true; var xlBook = oApplication.Workbooks.Add;oActiveSheet = xlBook.Worksheets(1); //设置行高oActiveSheet.Rows('1:1').RowHeight = 30;//设置列宽oActiveSheet.Columns('A:A').ColumnWidth = 8;//设置单元格的内容oActiveSheet.Cells(4,1).FormulaR1C1='日 期'; //第4行第1列//单元格选择oActiveSheet.Range('A2:G2').Select();//另外一种高级的选择方法oActiveSheet.Range(oActiveSheet.cells(5,3),oActiveSheet.Cells(6,4)).Select;//设置文字格式oApplication.Selection.Font.Size=15;oApplication.Selection.Font.bold= trueoApplication.Selection.Font.Name='宋体';//合并选取的单元格oApplication.Selection.Merge();//设置选取单元格的垂直对齐和水平对齐 oApplication.Selection.HorizontalAlignment = xlCenter; oApplication.Selection.VerticalAlignment = xlCenter;//注意,对selection的操作都适用于cells//设置自动换行oApplication.Selection.WrapText=true;//--></SCRIPT>
Powered by: BlogJava Copyright © Javaphua