在试用12版本
填充1000行, 10列数据+公式大概需要5分钟, 请问是我的方法不对,还是试用版受限?
代码如下
<html>
<head>
<link rel="styleSheet" href="gc.spread.sheets.12.0.0.css" />
<script src="gc.spread.sheets.all.12.0.0.min.js" type="text/javascript"></script>
<script src="gc.spread.sheets.resources.zh.12.0.0.min.js"
type="text/javascript"></script>
<!-- <link rel="styleSheet" href="spread/gc.spread.sheets.11.0.0.css" />
<script src="spread/gc.spread.sheets.all.11.0.0.min.js" type="text/javascript"></script>
<script src="spread/gc.spread.sheets.resources.zh.11.0.0.min.js"
type="text/javascript"></script> -->
</head>
<body>
<div style="width: 100%; height: 50px; border: 1px solid gray;">预算编制</div>
<div id="ss"
style="width: 100%; height: 660px; border: 1px solid gray;"><div id="msg" style="width:100%; height:600px;text-align:center">加载中.......</div></div>
<script type="text/javascript">
window.onload = function() {
var spread = new GC.Spread.Sheets.Workbook(document
.getElementById('ss'), {
sheetCount : 1
});
var sheet = spread.getSheet(0);
sheet.setRowCount(1100,GC.Spread.Sheets.SheetArea.viewport);
//var person = { name: 'Wang feng', age: 25, gender: 'Male', address: { postcode: '710075' } };
var scope = {
dept : {
sr : '少儿',
srhz : '少儿汇总'
},
subject : {
yyyr : '英语幼儿',
yy8r : '英语8人',
yy24r : '英语24人',
sx : '数学',
yw : '语文'
},
time:{
y:"财年",
q1:"暑假",
q2:"秋季",
q3:"寒假",
q4:"春季",
m:"月"
},
account:{
zrc:"总人次",
xbl:"续班率",
xbrc:"续班人次"
}
}
//var source = new GC.Spread.Sheets.Bindings.CellBindingSource(person);
//sheet.setBindingPath(2, 2, 'name');
//sheet.setBindingPath(3, 2, 'age');
//sheet.setBindingPath(4, 2, 'gender');
//sheet.setBindingPath(5, 2, 'address.postcode');
//var source = new GC.Spread.Sheets.Bindings.CellBindingSource(scope);
//设置背景色
//range.Row, range.Column, range.RowCount, range.ColumnCount
sheet.getRange(0, 0, 1, 2).backColor("rgb(247, 197, 113)");
//sheet.getCell(4,1).backColor("rgb(20, 140, 1218)");
sheet.setText(0, 0, "部门");
sheet.addSpan(0, 0, 2, 1);
var cell = sheet.getCell(0, 0);
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
sheet.setText(0, 1, "科目");
sheet.addSpan(0, 1, 2, 1);
var cell = sheet.getCell(0, 1);
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
//指标
//财年
//sheet.setBindingPath(0,2,'time.y');
sheet.setText(0,2,"财年");
sheet.addSpan(0, 2, 1, 3);
cell = sheet.getCell(0, 2);
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
cell.backColor("Yellow");
// sheet.setBindingPath(1,2,'account.zrc')
// sheet.setBindingPath(1,3,'account.xbl')
// sheet.setBindingPath(1,4,'account.xbrc')
sheet.setText(1,2,"总人次");
sheet.setText(1,3,"续班率");
sheet.setText(1,4,"续班人次");
//暑假
//sheet.setBindingPath(0,5,'time.q1');
sheet.setText(0,5,"暑假");
sheet.addSpan(0, 5, 1, 3);
cell = sheet.getCell(0, 5);
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
cell.backColor("gray");
// sheet.setBindingPath(1,5,'account.zrc')
// sheet.setBindingPath(1,6,'account.xbl')
// sheet.setBindingPath(1,7,'account.xbrc')
sheet.setText(1,5,"总人次");
sheet.setText(1,6,"续班率");
sheet.setText(1,7,"续班人次");
//秋季
// sheet.setBindingPath(0,8,'time.q2')
sheet.setText(0,8,"秋季");
sheet.addSpan(0, 8, 1, 3);
cell = sheet.getCell(0, 8);
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
cell.backColor("yellow");
// sheet.setBindingPath(1,8,'account.zrc')
// sheet.setBindingPath(1,9,'account.xbl')
// sheet.setBindingPath(1,10,'account.xbrc')
sheet.setText(1,8,"总人次");
sheet.setText(1,9,"续班率");
sheet.setText(1,10,"续班人次");
//寒假
// sheet.setBindingPath(0,11,'time.q3')
sheet.setText(0,11,"寒假");
sheet.addSpan(0, 11, 1, 3);
cell = sheet.getCell(0, 11);
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
cell.backColor("gray");
// sheet.setBindingPath(1,11,'account.zrc')
// sheet.setBindingPath(1,12,'account.xbl')
// sheet.setBindingPath(1,13,'account.xbrc')
sheet.setText(1,11,"总人次");
sheet.setText(1,12,"续班率");
sheet.setText(1,13,"续班人次");
//春季
// sheet.setBindingPath(0,14,'time.q4')
sheet.setText(0,8,"春季");
sheet.addSpan(0, 14, 1, 3);
cell = sheet.getCell(0, 14);
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
cell.backColor("yellow");
// sheet.setBindingPath(1,14,'account.zrc')
// sheet.setBindingPath(1,15,'account.xbl')
// sheet.setBindingPath(1,16,'account.xbrc')
sheet.setText(1,14,"总人次");
sheet.setText(1,15,"续班率");
sheet.setText(1,16,"续班人次");
//设置指标间公式
// sheet.setFormula(2,4,"c3*d3");
for(var i=0;i<100;i++){
console.log(i);
//部门
// sheet.setBindingPath(detpindex, 0, "dept.sr");
var detpindex=2+i*5;
var index3=3+i*5;
var index4=4+i*5;
var index5=5+i*5;
var index6=6+i*5;
var index7=7+i*5;
sheet.setText(detpindex, 0,"少儿"+i);
//合并单元格
sheet.addSpan(detpindex, 0, 5, 1);
//居中
cell = sheet.getCell(detpindex, 0);
cell.hAlign(GC.Spread.Sheets.HorizontalAlign.center);
cell.vAlign(GC.Spread.Sheets.VerticalAlign.center);
//科目
// sheet.setBindingPath(detpindex, 1, 'subject.yyyr');
// sheet.setBindingPath(index3, 1, 'subject.yy8r');
// sheet.setBindingPath(index4, 1, 'subject.yy24r');
// sheet.setBindingPath(index5, 1, 'subject.sx');
// sheet.setBindingPath(index6, 1, 'subject.yw');
sheet.setText(detpindex,1,"英语幼儿");
sheet.setText(index3,1,"英语8人");
sheet.setText(index4,1,"英语24人");
sheet.setText(index5,1,"数学");
sheet.setText(index6,1,"语文");
// sheet.setFormula(detpindex,4,"c"+(index3)+"*d"+(index3));
// sheet.setFormula(index3,4,"c"+(index4)+"*d"+(index4));
// sheet.setFormula(index4,4,"c"+(index5)+"*d"+(index5));
// sheet.setFormula(index5,4,"c"+(index6)+"*d"+(index6));
// sheet.setFormula(index6,4,"c"+(index7)+"*d"+(index7));
// sheet.setFormula(detpindex,7,"f"+(index3)+"*g"+(index3));
// sheet.setFormula(index3,7,"f"+(index4)+"*g"+(index4));
// sheet.setFormula(index4,7,"f"+(index5)+"*g"+(index5));
// sheet.setFormula(index5,7,"f"+(index6)+"*g"+(index6));
// sheet.setFormula(index6,7,"f"+(index7)+"*g"+(index7));
// sheet.setFormula(detpindex,10,"i"+(index3)+"*j"+(index3));
// sheet.setFormula(index3,10,"i"+(index4)+"*j"+(index4));
// sheet.setFormula(index4,10,"i"+(index5)+"*j"+(index5));
// sheet.setFormula(index5,10,"i"+(index6)+"*j"+(index6));
// sheet.setFormula(index6,10,"i"+(index7)+"*j"+(index7));
// sheet.setFormula(detpindex,13,"l"+(index3)+"*m"+(index3));
// sheet.setFormula(index3, 13,"l"+(index4)+"*m"+(index4));
// sheet.setFormula(index4,13,"l"+(index5)+"*m"+(index5));
// sheet.setFormula(index5,13,"l"+(index6)+"*m"+(index6));
// sheet.setFormula(index6,13,"l"+(index7)+"*m"+(index7));
// sheet.setFormula(detpindex,16,"o"+(index3)+"*p"+(index3));
// sheet.setFormula(index3, 16,"o"+(index4)+"*p"+(index4));
// sheet.setFormula(index4,16,"o"+(index5)+"*p"+(index5));
// sheet.setFormula(index5,16,"o"+(index6)+"*p"+(index6));
// sheet.setFormula(index6,16,"o"+(index7)+"*p"+(index7));
}
// sheet.setDataSource(source);
document.getElementById('msg').style.display="none";
};
</script>
</body>
</html>
|
|