Kendo UI Grid Export to Excel / PDF not working on IE9


I have a problem exporting Kendo UI Grid for Excel and PDF to IE9.
Everythig works fine with Chrome, but nothing happens in IE9.
Here is my grid. Is there something wrong or not?

        $("#gridDetalhes").kendoGrid({

            dataSource: {
                data: myJsonList
            },


            excel: {
                allPages: true,
                fileName: "SGD_Detalhes.xlsx"
            },


            toolbar: ["excel", "pdf"],


            columns: [


                   { field: "DataInicio", width: "135px", title: "Início", type: "date", template: '#= kendo.toString(DataInicio,"dd/MM/yyyy HH:mm:ss") #' },
                   { field: "DataFim", width: "135px", title: "Fim", type: "date", template: '#= kendo.toString(DataFim,"dd/MM/yyyy HH:mm:ss") #' },
                   { field: "Duracao", width: "80px", title: "Duração", type: "string" },
                   { field: "Gerador", width: "40px", title: "A/M", type: "string" },
                   { field: "Identificador", width: "120px", title: "Identificador", type: "string" },

            ]


        });
+4
source share
3 answers

The export function does not support Safari, IE9 and below. For unsupported browsers, you need to specify proxyUrlto provide the proxy server URL.

See examples of server proxy implementations (for ASP.NET WebForms / API / MVC, PHP, Java / Spring MVC)

For example, the server controller action for ASP.NET MVC:

public class HomeController
{
    [HttpPost]
    public ActionResult KendoSave(string contentType, string base64, string fileName)
    {
        var fileContents = Convert.FromBase64String(base64);

        return File(fileContents, contentType, fileName);
    }
}

proxyUrl, :

excel: {
                allPages: true,
                fileName: "SGD_Detalhes.xlsx"
                proxyURL: "/Home/KendoSave",
       }

, .

+7

Kendo, DOCTYPES, XHTML 1.1, XHTML 1.0 Strict HTML4 Strict

, IE Edge META- HTTP-

<meta http-equiv="X-UA-Compatible" content="IE=edge" />
0

I struggled with the same problem and implemented the server side, so I ended up with the simplest version of nodejs. Here is the code:

var fs = require('fs');
var express = require('express');
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
app.post('/save', function(req,res){
  var fContents = req.body.base64;
  var fName = req.body.fileName;
  var buffer = new Buffer(fContents, 'base64');
  res.setHeader('Content-disposition', 'attachment; filename=' + fName);
  res.send(buffer);
})
app.listen(80);
0
source

Source: https://habr.com/ru/post/1570031/


All Articles