VisActor / VTable

VTable is not just a high-performance multidimensional data analysis table, but also a grid artist that creates art between rows and columns.
https://visactor.io/vtable
MIT License
1.43k stars 103 forks source link

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

Closed xiaochong444 closed 2 weeks ago

xiaochong444 commented 3 weeks ago

What problem does this feature solve?

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

What does the proposed API look like?

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

Rui-Sun commented 2 weeks ago

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 commented 2 weeks ago

@

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 commented 2 weeks ago

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%';