Recently done a project involves the export of data into Excel, search the Internet to find, finally found two ways, nonsense not much to say
The first type:
Get the ID of the table can grab the data of the table, export to Excel, this method is simple and rude, introduce the two plug-ins can be.
But in this way there will be a problem, that is, when your table has paging, this thing can only crawl the value on the page, so do not say more, the other pagination is not derived, the value can export the current paging data.
However, the project requires that all data be exported, and there is a second solution
It is also relatively simple to use, to get the data directly inside the plug is, the last call method. In this case, all the data comes out eventually.
function Jsontoexcelconvertor (Jsondata, FileName, ShowLabel) {var arrdata = typeof Jsondata! = ' object '? Json.parse (jsondata): Jsondata; var excel = ' <table> '; Set table header var row = "<tr>" for (var i = 0, L = showlabel.length; i < L; i++) {row + = "<td>" + Showlabe L[i].value + ' </td> ';} Line-Wrapping Excel + = row + "</tr>"; Set data for (var i = 0; i < arrdata.length; i++) {var row = "<tr>"; for (Var j=0;j<arrdata[i].length;j++) {var = arrdata[i][j].value = = = = = = = "."? "": arrdata[i][j].value; Row + = ' <td> ' + value + ' </td> '; }
excel + = row + "</tr>"; } Excel + = "</table>"; var excelfile = "
JSON data export Excel