Skip to content
New issue

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功能优化[Feature] #1989

Closed
xiaochong444 opened this issue Jun 26, 2024 · 3 comments · Fixed by #2020
Closed

导出excel功能优化[Feature] #1989

xiaochong444 opened this issue Jun 26, 2024 · 3 comments · Fixed by #2020
Assignees
Labels

Comments

@xiaochong444
Copy link

What problem does this feature solve?

当前导出excel时是直接导出表格的字符,如果表格使用了格工化函数,比如数字加了千分号或者百分比等,导出EXCEL就变成了文本格式,这个时间要进行二次加工就非常的麻烦了。

What does the proposed API look like?

希望导出的时候可以支持原始值导出,并有选项可以配置每一列的格式化字符,这样可以适配excel里的单元格格式,不影响表格的二次加工。

@Rui-Sun
Copy link
Contributor

Rui-Sun commented Jun 28, 2024

https://www.visactor.io/vtable/guide/export/excel
image
目前已经提供了导出格式化接口,调用table.getCellOriginValue(col,row)可获取原始数据;如果需要匹配excel数据,需要返回值符合exceljs value规则 https://github.com/exceljs/exceljs/tree/master?tab=readme-ov-file#value-types

@xiaochong444
Copy link
Author

@

https://www.visactor.io/vtable/guide/export/excel image 目前已经提供了导出格式化接口,调用table.getCellOriginValue(col,row)可获取原始数据;如果需要匹配excel数据,需要返回值符合exceljs value规则 https://github.com/exceljs/exceljs/tree/master?tab=readme-ov-file#value-types

现在返回的只是值,格式化需要用到exceljs的numFmt ,感觉现在设计的导出格式化问题有点不对吧,应该是改显示格式,不是改单元格的值

@xiaochong444
Copy link
Author

https://www.visactor.io/vtable/guide/export/excel image 目前已经提供了导出格式化接口,调用table.getCellOriginValue(col,row)可获取原始数据;如果需要匹配excel数据,需要返回值符合exceljs value规则 https://github.com/exceljs/exceljs/tree/master?tab=readme-ov-file#value-types
格式化应该是像这样,单元格的值还是原始值,显示格式传excel支持的格式,不然导出来全是文本
ws.getCell('B1').value = 0.016;
ws.getCell('B1').numFmt = '0.00%';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants