本帖最后由 Derrick.Jiao 于 2021-8-2 12:21 编辑
如下图,列A使用自定义格式,并为表设置筛选器。
点击筛选箭头后如下图所示,筛选框内容为空。
打开控制台发现报错,如下图:
代码如下:
- function C(){}
- C.prototype = new GC.Spread.Formatter.FormatterBase();
- C.prototype.format = function(a){return a?a.toString():"";}
- window.onload = function () {
- var spread = new GC.Spread.Sheets.Workbook(document.getElementById("ss"));
- var sheet = spread.getActiveSheet();
- sheet.setArray(0,0,[
- ["自定义格式列","默认格式列","无格式列"],
- [12345678901234567890,12345678901234567890,12345678901234567890],
- [123456.78,123456.78,123456.78],
- [123456,123456,123456],
- ]);
-
- spread.getActiveSheet().getRange(0,0,10,1).formatter(new C()); // A列自定义格式,
- spread.getActiveSheet().getRange(0,2,10,1).formatter(new GC.Spread.Formatter.GeneralFormatter());
- for (let i = 0; i < 4; i++) {
- sheet.autoFitColumn(i);
- }
- sheet.rowFilter(new GC.Spread.Sheets.Filter.HideRowFilter(new GC.Spread.Sheets.Range(0,0,sheet.getRowCount(),sheet.getColumnCount())));
-
- };
复制代码
|