We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@antv/s2-react | 2.0.0-next.25
导出数据只要数据内容带,逗号的 在excel中就会按逗号拆分显示成多个单元格
const s2DataConfig: S2DataConfig = { fields: { rows: ['province', 'city'], columns: ['type', 'sub_type'], values: ['number'], }, meta: res.meta, data: [ { "number": '7,789', "province": "浙,江省", "city": "杭州市", "type": "家具", "sub_type": "桌子" }, { "number": 2367, "province": "浙江省", "city": "绍兴市", "type": "家具", "sub_type": "桌子" }, { "number": 3877, "province": "浙江省", "city": "宁波市", "type": "家具", "sub_type": "桌子" }, { "number": 4342, "province": "浙江省", "city": "舟山市", "type": "家具", "sub_type": "桌子" }, { "number": 5343, "province": "浙江省", "city": "杭州市", "type": "家具", "sub_type": "沙发" }, { "number": 632, "province": "浙江省", "city": "绍兴市", "type": "家具", "sub_type": "沙发" }, { "number": 7234, "province": "浙江省", "city": "宁波市", "type": "家具", "sub_type": "沙发" }, { "number": 834, "province": "浙江省", "city": "舟山市", "type": "家具", "sub_type": "沙发" }, { "number": 945, "province": "浙江省", "city": "杭州市", "type": "办公用品", "sub_type": "笔" }, { "number": 1304, "province": "浙江省", "city": "绍兴市", "type": "办公用品", "sub_type": "笔" }, { "number": 1145, "province": "浙江省", "city": "宁波市", "type": "办公用品", "sub_type": "笔" }, { "number": 1432, "province": "浙江省", "city": "舟山市", "type": "办公用品", "sub_type": "笔" }, { "number": 1343, "province": "浙江省", "city": "杭州市", "type": "办公用品", "sub_type": "纸张" }, { "number": 1354, "province": "浙江省", "city": "绍兴市", "type": "办公用品", "sub_type": "纸张" }, { "number": 1523, "province": "浙江省", "city": "宁波市", "type": "办公用品", "sub_type": "纸张" }, { "number": 1634, "province": "浙江省", "city": "舟山市", "type": "办公用品", "sub_type": "纸张" }, { "number": 1723, "province": "四川省", "city": "成都市", "type": "家具", "sub_type": "桌子" }, { "number": 1822, "province": "四川省", "city": "绵阳市", "type": "家具", "sub_type": "桌子" }, { "number": 1943, "province": "四川省", "city": "南充市", "type": "家具", "sub_type": "桌子" }, { "number": 2330, "province": "四川省", "city": "乐山市", "type": "家具", "sub_type": "桌子" }, { "number": 2451, "province": "四川省", "city": "成都市", "type": "家具", "sub_type": "沙发" }, { "number": 2244, "province": "四川省", "city": "绵阳市", "type": "家具", "sub_type": "沙发" }, { "number": 2333, "province": "四川省", "city": "南充市", "type": "家具", "sub_type": "沙发" }, { "number": 2445, "province": "四川省", "city": "乐山市", "type": "家具", "sub_type": "沙发" }, { "number": 2335, "province": "四川省", "city": "成都市", "type": "办公用品", "sub_type": "笔" }, { "number": 245, "province": "四川省", "city": "绵阳市", "type": "办公用品", "sub_type": "笔" }, { "number": 2457, "province": "四川省", "city": "南充市", "type": "办公用品", "sub_type": "笔" }, { "number": 2458, "province": "四川省", "city": "乐山市", "type": "办公用品", "sub_type": "笔" }, { "number": 4004, "province": "四川省", "city": "成都市", "type": "办公用品", "sub_type": "纸张" }, { "number": 3077, "province": "四川省", "city": "绵阳市", "type": "办公用品", "sub_type": "纸张" }, { "number": 3551, "province": "四川省", "city": "南充市", "type": "办公用品", "sub_type": "纸张" }, { "number": 352, "province": "四川省", "city": "乐山市", "type": "办公用品", "sub_type": "纸张" } ], "totalData": [ { "number": 26193, "type": "家具", "sub_type": "桌子" }, { "number": 49709, "type": "家具" }, { "number": 23516, "type": "家具", "sub_type": "沙发" }, { "number": 29159, "type": "办公用品" }, { "number": 12321, "type": "办公用品", "sub_type": "笔" }, { "number": 16838, "type": "办公用品", "sub_type": "纸张" }, { "number": 18375, "province": "浙江省", "type": "家具", "sub_type": "桌子" }, { "number": 14043, "province": "浙江省", "type": "家具", "sub_type": "沙发" }, { "number": 4826, "province": "浙江省", "type": "办公用品", "sub_type": "笔" }, { "number": 5854, "province": "浙江省", "type": "办公用品", "sub_type": "纸张" }, { "number": 7818, "province": "四川省", "type": "家具", "sub_type": "桌子" }, { "number": 9473, "province": "四川省", "type": "家具", "sub_type": "沙发" }, { "number": 7495, "province": "四川省", "type": "办公用品", "sub_type": "笔" }, { "number": 10984, "province": "四川省", "type": "办公用品", "sub_type": "纸张" }, { "number": 13132, "province": "浙江省", "city": "杭州市", "type": "家具" }, { "number": 2288, "province": "浙江省", "city": "杭州市", "type": "办公用品" }, { "number": 15420, "province": "浙江省", "city": "杭州市" }, { "number": 2999, "province": "浙江省", "city": "绍兴市", "type": "家具" }, { "number": 2658, "province": "浙江省", "city": "绍兴市", "type": "办公用品" }, { "number": 5657, "province": "浙江省", "city": "绍兴市" }, { "number": 11111, "province": "浙江省", "city": "宁波市", "type": "家具" }, { "number": 2668, "province": "浙江省", "city": "宁波市", "type": "办公用品" }, { "number": 13779, "province": "浙江省", "city": "宁波市" }, { "number": 5176, "province": "浙江省", "city": "舟山市", "type": "家具" }, { "number": 3066, "province": "浙江省", "city": "舟山市", "type": "办公用品" }, { "number": 8242, "province": "浙江省", "city": "舟山市" }, { "number": 4174, "province": "四川省", "city": "成都市", "type": "家具" }, { "number": 6339, "province": "四川省", "city": "成都市", "type": "办公用品" }, { "number": 10513, "province": "四川省", "city": "成都市" }, { "number": 4066, "province": "四川省", "city": "绵阳市", "type": "家具" }, { "number": 3322, "province": "四川省", "city": "绵阳市", "type": "办公用品" }, { "number": 7388, "province": "四川省", "city": "绵阳市" }, { "number": 4276, "province": "四川省", "city": "南充市", "type": "家具" }, { "number": 6008, "province": "四川省", "city": "南充市", "type": "办公用品" }, { "number": 10284, "province": "四川省", "city": "南充市" }, { "number": 4775, "province": "四川省", "city": "乐山市", "type": "家具" }, { "number": 2810, "province": "四川省", "city": "乐山市", "type": "办公用品" }, { "number": 7585, "province": "四川省", "city": "乐山市" }, { "number": 32418, "province": "浙江省", "type": "家具" }, { "number": 10680, "province": "浙江省", "type": "办公用品" }, { "number": 43098, "province": "浙江省" }, { "number": 17291, "province": "四川省", "type": "家具" }, { "number": 18479, "province": "四川省", "type": "办公用品" }, { "number": 35770, "province": "四川省" }, { "number": 78868 } ]
(https://s2.antv.antgroup.com/examples/react-component/export/#export)
将上面的s2DataConfig替换链接的然后导出就会复现问题
The text was updated successfully, but these errors were encountered:
导出的 Excel 格式为 CSV, CSV 的分隔符就是逗号, 所以数据里面的逗号和分隔符冲突了, 目前不太好处理
Sorry, something went wrong.
但是1.x版本就没有这个问题
1.X 使用S2/packages/s2-core/src/utils/export/export-worker.ts 文件中的 export function getCsvString(v: any): string { if (!v) { return v; }
const value = replaceEmptyFieldValue(v);
if (typeof value === 'string') { const out = value; // 需要替换", https://en.wikipedia.org/wiki/Comma-separated_values#Example return "${out.replace(/"/g, '""')}"; }
return "${value}"; } 方法进行格式化后导出的
No branches or pull requests
🏷 Version
@antv/s2-react | 2.0.0-next.25
Sheet Type
🖋 Description
导出数据只要数据内容带,逗号的 在excel中就会按逗号拆分显示成多个单元格
⌨️ Code Snapshots
const s2DataConfig: S2DataConfig = {
fields: {
rows: ['province', 'city'],
columns: ['type', 'sub_type'],
values: ['number'],
},
meta: res.meta,
data: [
{
"number": '7,789',
"province": "浙,江省",
"city": "杭州市",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 2367,
"province": "浙江省",
"city": "绍兴市",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 3877,
"province": "浙江省",
"city": "宁波市",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 4342,
"province": "浙江省",
"city": "舟山市",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 5343,
"province": "浙江省",
"city": "杭州市",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 632,
"province": "浙江省",
"city": "绍兴市",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 7234,
"province": "浙江省",
"city": "宁波市",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 834,
"province": "浙江省",
"city": "舟山市",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 945,
"province": "浙江省",
"city": "杭州市",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 1304,
"province": "浙江省",
"city": "绍兴市",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 1145,
"province": "浙江省",
"city": "宁波市",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 1432,
"province": "浙江省",
"city": "舟山市",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 1343,
"province": "浙江省",
"city": "杭州市",
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 1354,
"province": "浙江省",
"city": "绍兴市",
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 1523,
"province": "浙江省",
"city": "宁波市",
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 1634,
"province": "浙江省",
"city": "舟山市",
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 1723,
"province": "四川省",
"city": "成都市",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 1822,
"province": "四川省",
"city": "绵阳市",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 1943,
"province": "四川省",
"city": "南充市",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 2330,
"province": "四川省",
"city": "乐山市",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 2451,
"province": "四川省",
"city": "成都市",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 2244,
"province": "四川省",
"city": "绵阳市",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 2333,
"province": "四川省",
"city": "南充市",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 2445,
"province": "四川省",
"city": "乐山市",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 2335,
"province": "四川省",
"city": "成都市",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 245,
"province": "四川省",
"city": "绵阳市",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 2457,
"province": "四川省",
"city": "南充市",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 2458,
"province": "四川省",
"city": "乐山市",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 4004,
"province": "四川省",
"city": "成都市",
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 3077,
"province": "四川省",
"city": "绵阳市",
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 3551,
"province": "四川省",
"city": "南充市",
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 352,
"province": "四川省",
"city": "乐山市",
"type": "办公用品",
"sub_type": "纸张"
}
],
"totalData": [
{
"number": 26193,
"type": "家具",
"sub_type": "桌子"
},
{
"number": 49709,
"type": "家具"
},
{
"number": 23516,
"type": "家具",
"sub_type": "沙发"
},
{
"number": 29159,
"type": "办公用品"
},
{
"number": 12321,
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 16838,
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 18375,
"province": "浙江省",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 14043,
"province": "浙江省",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 4826,
"province": "浙江省",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 5854,
"province": "浙江省",
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 7818,
"province": "四川省",
"type": "家具",
"sub_type": "桌子"
},
{
"number": 9473,
"province": "四川省",
"type": "家具",
"sub_type": "沙发"
},
{
"number": 7495,
"province": "四川省",
"type": "办公用品",
"sub_type": "笔"
},
{
"number": 10984,
"province": "四川省",
"type": "办公用品",
"sub_type": "纸张"
},
{
"number": 13132,
"province": "浙江省",
"city": "杭州市",
"type": "家具"
},
{
"number": 2288,
"province": "浙江省",
"city": "杭州市",
"type": "办公用品"
},
{
"number": 15420,
"province": "浙江省",
"city": "杭州市"
},
{
"number": 2999,
"province": "浙江省",
"city": "绍兴市",
"type": "家具"
},
{
"number": 2658,
"province": "浙江省",
"city": "绍兴市",
"type": "办公用品"
},
{
"number": 5657,
"province": "浙江省",
"city": "绍兴市"
},
{
"number": 11111,
"province": "浙江省",
"city": "宁波市",
"type": "家具"
},
{
"number": 2668,
"province": "浙江省",
"city": "宁波市",
"type": "办公用品"
},
{
"number": 13779,
"province": "浙江省",
"city": "宁波市"
},
{
"number": 5176,
"province": "浙江省",
"city": "舟山市",
"type": "家具"
},
{
"number": 3066,
"province": "浙江省",
"city": "舟山市",
"type": "办公用品"
},
{
"number": 8242,
"province": "浙江省",
"city": "舟山市"
},
{
"number": 4174,
"province": "四川省",
"city": "成都市",
"type": "家具"
},
{
"number": 6339,
"province": "四川省",
"city": "成都市",
"type": "办公用品"
},
{
"number": 10513,
"province": "四川省",
"city": "成都市"
},
{
"number": 4066,
"province": "四川省",
"city": "绵阳市",
"type": "家具"
},
{
"number": 3322,
"province": "四川省",
"city": "绵阳市",
"type": "办公用品"
},
{
"number": 7388,
"province": "四川省",
"city": "绵阳市"
},
{
"number": 4276,
"province": "四川省",
"city": "南充市",
"type": "家具"
},
{
"number": 6008,
"province": "四川省",
"city": "南充市",
"type": "办公用品"
},
{
"number": 10284,
"province": "四川省",
"city": "南充市"
},
{
"number": 4775,
"province": "四川省",
"city": "乐山市",
"type": "家具"
},
{
"number": 2810,
"province": "四川省",
"city": "乐山市",
"type": "办公用品"
},
{
"number": 7585,
"province": "四川省",
"city": "乐山市"
},
{
"number": 32418,
"province": "浙江省",
"type": "家具"
},
{
"number": 10680,
"province": "浙江省",
"type": "办公用品"
},
{
"number": 43098,
"province": "浙江省"
},
{
"number": 17291,
"province": "四川省",
"type": "家具"
},
{
"number": 18479,
"province": "四川省",
"type": "办公用品"
},
{
"number": 35770,
"province": "四川省"
},
{
"number": 78868
}
]
🔗 Reproduce Link
(https://s2.antv.antgroup.com/examples/react-component/export/#export)
🤔 Steps to Reproduce
将上面的s2DataConfig替换链接的然后导出就会复现问题
😊 Expected Behavior
导出数据只要数据内容带,逗号的 在excel中就会按逗号拆分显示成多个单元格
😅 Current Behavior
导出数据只要数据内容带,逗号的 在excel中就会按逗号拆分显示成多个单元格
💻 System information
The text was updated successfully, but these errors were encountered: