正常情况
降序
升序
参考文档:
https://help.fanruan.com/finereport/doc-view-888.html
https://help.fanruan.com/finereport/doc-view-894.html
实现方法:
1. 设置表头第一列(A1)动态参数, 添加了2个参数,a和asc
注意:我这里这列是日期,所以asc的值是:tointeger(format(A2,'yyyyMMdd'))
设置其他需要排序的表头动态参数,a和第一列一样,asc为对应的扩展数据单元格,例如下图为K2
2. 设置扩展数据列A2,
A2扩展后排序为: if($a = 1, eval($asc), eval($asc) * -1)
3. 设置样式,找到对应表头单元格,形态设置改为公式形态
第一列为日期,所以条件略有不同
- =IF(asc == "tointeger(format(A2,'yyyyMMdd'))", IF(a == 0, "<span>"+$+"</span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-bottom: 4px solid #999;position: relative; margin-left: 2px;top: -12px;'></span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-top: 4px solid #47a8ea;position: relative;margin-left: -8px;top: 13px;'></span>", "<span>"+$+"</span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-bottom: 4px solid #47a8ea;position: relative; margin-left: 2px;top: -12px;'></span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-top: 4px solid #999;position: relative;margin-left: -8px;top: 13px;'></span>"), "<span>"+$+"</span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-bottom: 4px solid #999;position: relative; margin-left: 2px;top: -12px;'></span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-top: 4px solid #999;position: relative;margin-left: -8px;top: 13px;'></span>")
复制代码
其他数据列形态设置:
这里巧妙的写了一个统一的判断条件,不然条件 asc == 'F2', asc == 'G2' 这样单元格每个都不同的话,工作量巨大。
- =IF(asc == CONCATENATE(CHAR(COL($)+64),row($)+1), IF(a == 0, "<span>"+$+"</span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-bottom: 4px solid #ddd;position: relative; margin-left: 2px;top: -12px;'></span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-top: 4px solid #4394e8;position: relative;margin-left: -8px;top: 13px;'></span>", "<span>"+$+"</span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-bottom: 4px solid #4394e8;position: relative; margin-left: 2px;top: -12px;'></span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-top: 4px solid #ddd;position: relative;margin-left: -8px;top: 13px;'></span>"), "<span>"+$+"</span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-bottom: 4px solid #999;position: relative; margin-left: 2px;top: -12px;'></span><span style='width: 0;height: 0;border-left: 4px solid transparent;border-right: 4px solid transparent;border-top: 4px solid #999;position: relative;margin-left: -8px;top: 13px;'></span>")
复制代码
4. 设置下表头样式,去掉下划线,文字修改为黑色。
每次点击超级链接后,文字颜色自动变成超链接样式。
编辑于 2021-4-15 18:13
编辑于 2021-4-15 18:23
编辑于 2021-4-15 18:24
编辑于 2021-4-15 18:24
编辑于 2021-4-15 18:26
编辑于 2021-4-15 18:31
|