如何使用Jquery导出从Web Api Mvc4到Excel工作表的Json数据 [英] How Do I Export Json Data Getting From Web Api Mvc4 To Excel Sheet Using Jquery

查看:105
本文介绍了如何使用Jquery导出从Web Api Mvc4到Excel工作表的Json数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用jquery导出json数据从web api mvc4导出到excel表????

how do i export json data getting from web api mvc4 to excel sheet using jquery????

推荐答案

我认为你的问题比如何更广泛,这就是我不认为你可以将所有可能的Json结构映射到Excel,因为Json允许分层数据而excel没有。即,您无法将包含其他对象和对象数组的对象映射到网格布局。如果您的Json是分层的,那么您可以考虑自己的映射方案,从而针对您可以显示的一个Json对象进行编码。但这可能涉及多个视图,并且它只能对付那个对象。

我不会考虑尝试使用Jquery将数据传递到Excel。即使有可能它似乎是滥用它?我个人会在API上添加导出CSV或类似内容的功能,然后将其传递给excel。 (但如上所述,可能无法实现。)
I think you have a wider problem than the how , and that is I don't think that you can map all possible Json structures to Excel since Json allows for hierarchical data and excel does not . I.e You cant map objects containing other objects and arrays of objects to a grid layout . If your Json is hierarchical then you can think up your own mapping scheme whereby you code against the one Json object you can display . But that might involve several views , and it would only work against that one object .
I would not consider attempting to use Jquery to pass data into Excel . Even if it were possible it seems a misuse of it ? Personally I would add the ability on the API to export a CSV or similar and then pass those into excel . ( But as mentioned above it may not be possible) .


这篇关于如何使用Jquery导出从Web Api Mvc4到Excel工作表的Json数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆