下载带有数值的制表符 table?
Download tabulator table with numeric values?
当尝试使用 sheetjs 从 Tabulator 库 table 下载 XLSX 格式的数据时,我的 table 中的数值在 MS Excel 中被识别为字符串。
下载功能里的所有参数我都试过了,但是没有这个选项
table.download("xlsx", "data.xlsx", {sheetName:"MyData"});
预期结果是带有数值的 MS Excel table,但是我得到的是字符串值,无法识别为数字。
您可能将 table 中的值存储为字符串而不是数字。
在将字符串用于电子表格之前,您是否尝试过使用 Download Accessor 将字符串转换为数字
例如,如果您有一个年龄列:
//custom accessor
function numberConvert(value, data, type, component){
return Number(value);
}
//column definition
{title:"Age", field:"ade", accessorDownload:numberConvert}
当尝试使用 sheetjs 从 Tabulator 库 table 下载 XLSX 格式的数据时,我的 table 中的数值在 MS Excel 中被识别为字符串。
下载功能里的所有参数我都试过了,但是没有这个选项
table.download("xlsx", "data.xlsx", {sheetName:"MyData"});
预期结果是带有数值的 MS Excel table,但是我得到的是字符串值,无法识别为数字。
您可能将 table 中的值存储为字符串而不是数字。
在将字符串用于电子表格之前,您是否尝试过使用 Download Accessor 将字符串转换为数字
例如,如果您有一个年龄列:
//custom accessor
function numberConvert(value, data, type, component){
return Number(value);
}
//column definition
{title:"Age", field:"ade", accessorDownload:numberConvert}