Excel报表之js版
1
var excel = new ActiveXObject("Excel.Application"); //创建AX对象excel
2
excel.visible =true; //设置excel可见属性
3
var workbook = excel.Workbooks.Add; //获取workbook对象
4
var sheet1 = xlBook.Worksheets(2); //创建sheet1
5
var sheet2 = xlBook.Worksheets(1); //创建sheet2
6
sheet1.Range(sheet1.Cells(1,1),sheet1.Cells(1,14)).mergecells=true; //合并单元格
7
sheet1.Range(sheet1.Cells(1,1),sheet1.Cells(1,14)).value="员工月考核成绩"; //设置单元格内容
8
sheet1.Range(sheet1.Cells(1,1),sheet1.Cells(1,14)).Interior.ColorIndex=6;//设置底色
9
sheet1.Range(sheet1.Cells(1,1),sheet1.Cells(1,14)).Font.ColorIndex=5;//设置字体色
10
sheet1.Rows(1).RowHeight = 20; //设置列高
11
sheet1.Rows(1).Font.Size=16; //设置文字大小
12
sheet1.Rows(1).Font.Name="宋体"; //设置字体
13
//设置每一列的标题
14
sheet1.Cells(2,1).Value="工程师考核项";
15
sheet1.Cells(2,2).Value="总分";
16
sheet1.Cells(2,3).Value="研发进度";
17
sheet1.Cells(2,4).Value="出勤率";
18
sheet1.Cells(2,5).Value="执行力";
19
sheet1.Cells(2,6).Value="责任心";
20
sheet1.Cells(2,7).Value="工作规范";
21
sheet1.Cells(2,8).Value="协作精神";
22
sheet1.Cells(2,9).Value="进取性";
23
sheet1.Cells(2,10).Value="工作合理性";
24
sheet1.Cells(2,11).Value="解决问题能力";
25
sheet1.Cells(2,12).Value="应变能力";
26
sheet1.Cells(2,13).Value="人际技能";
27
sheet1.Cells(2,14).Value="理解能力";
28
//从表单循环控件中取出数据逐行插入对应列的数据
29
var count = sfform.GetAttributeValue('Repeat','Count');
30
for(var line=1;line<=count;line++){ //begin for
31
var name = sfform.GetValue('Repeat['+line+'].name');
32
var total= sfform.GetValue('Repeat['+line+'].total');
33
var yfjd = sfform.GetValue('Repeat['+line+'].yfjd');
34
var jh = sfform.GetValue('Repeat['+line+'].jh');
35
var gcgj = sfform.GetValue('Repeat['+line+'].gcgj');
36
var cql = sfform.GetValue('Repeat['+line+'].cql');
37
var zxl = sfform.GetValue('Repeat['+line+'].zxl');
38
var gzgf = sfform.GetValue('Repeat['+line+'].gzgf');
39
var zrx = sfform.GetValue('Repeat['+line+'].zrx');
40
var xzjs = sfform.GetValue('Repeat['+line+'].xzjs');
41
var jqx = sfform.GetValue('Repeat['+line+'].jqx');
42
var gzhl = sfform.GetValue('Repeat['+line+'].gzh');
43
var jjwt = sfform.GetValue('Repeat['+line+'].jjwt');
44
var ybnl = sfform.GetValue('Repeat['+line+'].ybnl');
45
var rjjn = sfform.GetValue('Repeat['+line+'].rjjn');
46
var ljnl = sfform.GetValue('Repeat['+line+'].ljnl');
47
sheet1.Cells(2+line,1).Value=name;
48
sheet1.Cells(2+line,2).Value=total;
49
sheet1.Cells(2+line,3).Value=yfjd;
50
sheet1.Cells(2+line,4).Value=cql;
51
sheet1.Cells(2+line,5).Value=zxl;
52
sheet1.Cells(2+line,6).Value=gzgf;
53
sheet1.Cells(2+line,7).Value=zrx;
54
sheet1.Cells(2+line,8).Value=xzjs;
55
sheet1.Cells(2+line,9).Value=jqx;
56
sheet1.Cells(2+line,10).Value=gzhl;
57
sheet1.Cells(2+line,11).Value=jjwt;
58
sheet1.Cells(2+line,12).Value=ybnl;
59
sheet1.Cells(2+line,13).Value=rjjn;
60
sheet1.Cells(2+line,14).Value=ljnl;
61
62
}//end for
63
64
http://www.blogjava.net/beyondduke/archive/2006/08/05/61911.html

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

---------------------------------------------