- autoFitViewportRow(sheet,colInfos,header,dataJson) {
- sheet.suspendPaint();
- var brow = sheet.getViewportBottomRow(1)+1;
- if(this.fittedRowIndex < brow){
- for(var r=this.fittedRowIndex; r<brow; r++){
- sheet.autoFitRow(r);
- sheet.suspendCalcService(false);
- for(var c in colInfos){ //colInfos是每一列的信息 可能这一列是公式
- if(colInfos[c].formular){
- sheet.setFormula(parseInt(r),parseInt(c),colInfos[c].formular);
- }
- if (colInfos[c].formular) {
- var obj = {
- row: header.length+1,
- col: parseInt(c),
- rowCount: 1,
- colCount: 1,
- };
- var objWh = {
- row: header.length+1,
- col: parseInt(c),
- rowCount: brow,
- colCount: 1,
- }
- var startRange = new GC.Spread.Sheets.Range(obj.row, obj.col, obj.rowCount, obj.colCount)
- var wholeRange = new GC.Spread.Sheets.Range(objWh.row, objWh.col, objWh.rowCount, objWh.colCount)
- sheet.fillAuto(startRange, wholeRange, {
- series: 0,
- fillType: GC.Spread.Sheets.Fill.FillType.auto
- });
- }
- }
- sheet.resumeCalcService(true);
- }
- this.fittedRowIndex = brow;
- }
- sheet.resumePaint();
- }
复制代码
看看咋优化? |