您好,getRange后调用setBorder的确是遍历所有单元格进行的操作,
这里提供两个优化思路:
1、查看是否执行了sheet.suspendPaint()进行暂停绘制?参考学习指南:
https://demo.grapecity.com.cn/sp ... t/sheetPaint/purejs
2、直接给整行或整列设置边框样式,参考学习指南关于行、列style的描述:
https://demo.grapecity.com.cn/sp ... ksheet/style/purejs
演示代码如下:
- var style = new GC.Spread.Sheets.Style();
- style.borderLeft =new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
- style.borderTop = new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
- style.borderRight = new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
- style.borderBottom = new GC.Spread.Sheets.LineBorder("blue",GC.Spread.Sheets.LineStyle.medium);
- sheet.setStyle(-1, 5, style);
复制代码 |