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
下载格式化数据内容有,逗号的会在Excel中按逗号拆分成多个单元格,但是复制格式化数据就不会出现这种情况
const s2DataConfig: S2DataConfig = { fields: { rows: ['province', 'city'], columns: ['type', 'sub_type'], values: ['number'], }, meta: [ { "field": "number", "name": "数量", formatter: (value, record, meta) => { return Number(value).toFixed(3).toString().replace(/(\d)(?=(\d{3})+.)/g,"$1,") // return ${value / 100} % }, }, { "field": "province", "name": "省份" }, { "field": "city", "name": "城市" }, { "field": "type", "name": "类别" }, { "field": "sub_type", "name": "子类别" } ], data: res.data, };
${value / 100} %
(https://s2.antv.antgroup.com/examples/react-component/export/#export)
将上面的s2DataConfig替换掉链接中的s2DataConfig 点击下载格式化数据和复制格式化数据,会发现下载格式化数据内容有,逗号的会在Excel中按逗号拆分成多个单元格,但是复制格式化数据就不会出现这种情况
The text was updated successfully, but these errors were encountered:
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, '""')}"; }
"${out.replace(/"/g, '""')}"
return "${value}"; } 方法进行格式化后导出的
"${value}"
Sorry, something went wrong.
No branches or pull requests
🏷 Version
Sheet Type
🖋 Description
下载格式化数据内容有,逗号的会在Excel中按逗号拆分成多个单元格,但是复制格式化数据就不会出现这种情况
⌨️ Code Snapshots
const s2DataConfig: S2DataConfig = {
fields: {
rows: ['province', 'city'],
columns: ['type', 'sub_type'],
values: ['number'],
},
meta: [
{
"field": "number",
"name": "数量",
formatter: (value, record, meta) => {
return Number(value).toFixed(3).toString().replace(/(\d)(?=(\d{3})+.)/g,"$1,")
// return
${value / 100} %
},
},
{
"field": "province",
"name": "省份"
},
{
"field": "city",
"name": "城市"
},
{
"field": "type",
"name": "类别"
},
{
"field": "sub_type",
"name": "子类别"
}
],
data: res.data,
};
🔗 Reproduce Link
(https://s2.antv.antgroup.com/examples/react-component/export/#export)
🤔 Steps to Reproduce
将上面的s2DataConfig替换掉链接中的s2DataConfig 点击下载格式化数据和复制格式化数据,会发现下载格式化数据内容有,逗号的会在Excel中按逗号拆分成多个单元格,但是复制格式化数据就不会出现这种情况
😊 Expected Behavior
😅 Current Behavior
💻 System information
The text was updated successfully, but these errors were encountered: