格式化Excel行空间JavaScript ActiveXObject

如何修复我的excel activexobject电子表格中的行距。 这些行太小,无法显示在工作表中的所有信息。 对于activexobject excel电子表格的任何其他参考也将赞赏。

$scope.exportStudents = function () { excel = new ActiveXObject('Excel.Application'); excel.Workbooks.Add(); excel.Application.Visible = true; excel.ActiveSheet.Cells(1, 1).Value = "User ID"; excel.ActiveSheet.Cells(1, 2).Value = "Name"; excel.ActiveSheet.Cells(1, 3).Value = "Emergency Phone"; excel.ActiveSheet.Cells(1, 4).Value = "Cell Phone"; excel.ActiveSheet.Cells(1, 5).Value = "Provider"; excel.ActiveSheet.Cells(1, 6).Value = "Emergency Phone"; excel.ActiveSheet.Cells(1, 7).Value = "E-Mail"; excel.ActiveSheet.Cells(1, 8).Value = "Hire Date"; excel.ActiveSheet.Cells(1, 9).Value = "Grad Date"; excel.ActiveSheet.Cells(1, 10).Value = "Major 1"; excel.ActiveSheet.Cells(1, 11).Value = "Major 2"; excel.ActiveSheet.Cells(1, 12).Value = "School"; excel.ActiveSheet.Cells(1, 13).Value = "Active"; excel.ActiveSheet.Cells(1, 14).Value = "Admin Status"; }; 

加:

 excel.ActiveSheet.Cells.EntireColumn.AutoFit(); 

文档: 对象模型参考(Excel 2013开发人员参考)

将录制的macrosVBA翻译成JScript也相当简单。