- function fillData(sheet, data) {
- console.time("fillData");
- var row = parseInt($("#startRow").val());
- var col = parseInt($("#startColumn").val());
- var length = data.length;
-
- var rowArray = new Array();
- for ( var i = 0; i < length; i++) {
- var columnArray = new Array();
- var item = data[i];
- $(item.dataList).each(function(j, value) {
- var nowColumn = col + j;
- var v = value["text"];;
- if (nowColumn in dicColumn) {
- if (hasLength(value["value"]) && !isNaN(value["value"])) {
- v = parseInt(value["value"]);
- } else {
- }
- } else {
- }
- if(!hasLength(v)){
- v = "";
- }
- columnArray.push(v);
- });
- rowArray.push(columnArray);
- }
-
- for (var c in dicColumn) {
- var combo = cache.getCache(dicColumn[c]);
- for(var i=row+1;i<=row+length;i++){
- sheet.getCell(i, c).cellType(combo);
- }
- }
- console.log(rowArray);
- spread.getActiveSheet().setArray(row+1, col, rowArray);
- console.timeEnd("fillData");
- }
复制代码 |