Export Data in Classes/DataTable/CSV/JSON

Exporter to Word/Excel/PDF from Classes/DataTable/CSV/JSON

Modify the data and press export

Export CSV

Word Excel PDF

Export RSS

Word Excel PDF

Export JSON

Word Excel PDF

Sample code with Javascript

        <!-- be sure to include jquery -->
        <a href="#" onclick="return ExportJSON();">Export JSON</a></p>
        function ExportJSON(){
        //this is your array with data
        var arr=[];
        arr.push({ 'Name':'Andrei Ignat','WebSite':'http://msprogrammer.serviciipeweb.ro/','CV':'http://serviciipeweb.ro/iafblog/content/binary/cv.doc'});
        arr.push({ 'Name':'Your name','WebSite':'http://yoursite','CV':'cv.doc' });
        //we will stringify
        var data = JSON.stringify(arr);
        var id=5;//5=xlsx, 4=docx, 3 = pdf
        var urlData='http://exporter.azurewebsites.net/api/export/ExportFromJSON/' + id;
        //and export
        Export(urlData, id, data);
        return false;
        //extension of the file
        function findExtension(id) {
        switch (id) {
        case 5:
        return "xlsx";
        case 4:
        return "docx";
        case 3:
        return "pdf";
        return "notKnown" + id;
        //step 1: POST data, obtain unique id for the export document
        //step 2: obtain file from the unique id
        function Export(urlExport,id, data) {
        var ext = findExtension(id);
        //step 1 - post data
        type: "POST",
        url: urlExport,
        data: JSON.stringify({ 'data': data }),
        datatype: "JSON",
        contentType: "application/json; charset=utf-8"
        .done(function(result) {
        //step 2 - obtain file
        var urlDownload = 'http://exporter.azurewebsites.net/api/export/GetFile/' + result;
        urlDownload += "?fileName=andrei&extension="+ext;
        .fail(function(f) {
        alert("error:" + f.responseText);
More samples at https://github.com/ignatandrei/Exporter/wiki

Fork me on GitHub You can also buy me a beer by donating at PayPal