0
var ws = XLSX.utils.json_to_sheet(data);
    ws.set_column('Y1', None, None, {'hidden': True});

/* add to workbook */
var wb = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(wb, ws, 'content');

/* generate an XLSX file */
XLSX.writeFile(wb, 'test.xlsx');

}

我正在使用这样的角度 4 导出 json 对象,它给了我预期的结果。

但是当我试图隐藏特定列时

/* hide column*/
if (this.column === 'No') {
ws.set_column('A1', None, None, {'hidden': True});

}

在此代码中,它给了我错误Nonetrue即找不到名称 none 和 true。

4

1 回答 1

0

在 sheetJs 中没有这样的 set_column() 函数。

如果有人真的删除某些列或行可以删除map

例如:=

假设你有response一些变量叫做resultResposne

this.resultResponse.map((obj) =>{



 if(){ 

    // your condition goes here
       delete obj.`your column`;

    }

})
于 2019-03-25T13:38:25.807 回答