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

痞子三分冷 提交于 2019-12-03 16:18:14
Terri

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

See examples of Server Proxy Implementations (for ASP.NET WebForms/API/MVC, PHP, Java/Spring MVC)

For example - 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);
    }
}

And then you need to provide proxyUrl parameter pointing to this action:

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

Hope it helps.

Specify the Kendo UI recommended DOCTYPES like XHTML 1.1, XHTML 1.0 Strict or HTML4 Strict in your markup

Also, use IE's Edge mode via META tag or HTTP header

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

I was struggling myself with the same issue and implementing the server-side, so I've ended up with the simplest nodejs version. Here's 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);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!