antvis / S2

⚡️ A practical visualization library for tabular analysis.
https://s2.antv.antgroup.com
MIT License
1.47k stars 195 forks source link

🐛 next版本明细表导出列头meta配置失效 #2644

Closed wozien closed 6 months ago

wozien commented 6 months ago

🏷 Version

Package Version
@antv/s2 2.0.0-next.17

Sheet Type

🖋 Description

next版本明细表导出列头meta配置失效, 导出还是显示原来的字段field

image

调用asyncGetAllPlainData获取导出数据,打印如下: name,area,price iphone15,华东,6999 iphone15 pro,华东,8999

⌨️ Code Snapshots

https://stackblitz.com/edit/vitejs-vite-m4qgeu?file=src%2FApp.tsx

🔗 Reproduce Link

https://stackblitz.com/edit/vitejs-vite-m4qgeu?file=src%2FApp.tsx

🤔 Steps to Reproduce

明细表调用asyncGetAllPlainData

😊 Expected Behavior

列头正常显示中文格式化

😅 Current Behavior

列头没有正常显示中文格式化

💻 System information

Environment Info
System macos 13
Browser 123.0.6312.87(正式版本) (arm64)
lijinke666 commented 6 months ago

你这里关闭了格式化的配置, 所以未按 meta 格式化是符合预期的.

image

https://s2.antv.antgroup.com/manual/advanced/interaction/copy#formatoptions

这样修改下即可

image

const data = await asyncGetAllPlainData({
  sheetInstance: s2Instance.current,
  split: ',',
- formatOptions: false,
+ formatOptions: true,
// 或者
+ formatOptions: {
+   formatHeader: true;
+   formatData: true;
+ }
});
wozien commented 6 months ago

感谢回复,但是我发现交叉表formatOptions:false导出是正常的