1金币
- sheet.suspendPaint();
- sheet.setValue(2,0,1,3);
- sheet.setValue(3,0,15,3);
- sheet.setValue(4,0,25,3);
- sheet.setValue(5,0,-1,3);
- let base = GC.Spread.Sheets.ConditionalFormatting.IconSetRule.getIcon;
- GC.Spread.Sheets.ConditionalFormatting.IconSetRule.getIcon = function (iconSetType, iconIndex) {
- return 'http://a3.att.hudong.com/68/61/300000839764127060614318218_950.jpg';
- }
- const iconSetRule = new GC.Spread.Sheets.ConditionalFormatting.IconSetRule();
- iconSetRule.ranges([new GC.Spread.Sheets.Range(0,0,sheet.getRowCount() -1,1)]);
- iconSetRule.iconSetType(GC.Spread.Sheets.ConditionalFormatting.IconSetType.threeArrowsColored);
- const iconCriteria = iconSetRule.iconCriteria();
- iconCriteria[0] = new GC.Spread.Sheets.ConditionalFormatting.IconCriterion(true, GC.Spread.Sheets.ConditionalFormatting.IconValueType.number, 1);
- iconCriteria[1] = new GC.Spread.Sheets.ConditionalFormatting.IconCriterion(true, GC.Spread.Sheets.ConditionalFormatting.IconValueType.number, 10);
- iconCriteria[2] = new GC.Spread.Sheets.ConditionalFormatting.IconCriterion(true, GC.Spread.Sheets.ConditionalFormatting.IconValueType.number, 20);
- iconSetRule.reverseIconOrder(false);
- iconSetRule.showIconOnly(false);
- sheet.conditionalFormats.addRule(iconSetRule);
- sheet.resumePaint();
复制代码 参考的这个,但是我只想给某一列的部分单元格设置图标该怎么处理?
然后为什么我设置了图片,怎么出来的还是默认图标(箭头)
|
最佳答案
查看完整内容
给某一列的部分单元格设置图标
iconSetRule.ranges([new GC.Spread.Sheets.Range(0,0,sheet.getRowCount() -1,1)]);
修改这一句代码,某一区域的单元格设置图标,可以对应修改Range ,例如:
new GC.Spread.Sheets.Range(0,0,3,1) // 代表 从 0,0,行列开始,共3行、1列
设置了图片还是默认图标的问题,需要您提供下能复现问题的代码,方便跟踪调试问题
|