我正在自学剑道网格,找不到用于将pdf和excel导出到其他目录(然后下载文件夹)的示例或演示。 目前,当我按下“导出到excel”和“导出到pdf”按钮时,我的代码自动将导出的文件下载到“下载”文件夹中。
我已经尝试过“ saveAs()”,但这不是我想要的功能。这是我的代码。
toolbar: ["create", "excel", "pdf"],
excel: {
fileName: "Kendo UI Grid Export.xlsx",
filterable: true
},
pdf: {
allPages: true,
avoidLinks: true,
paperSize: "A4",
margin: { top: "2cm", left: "1cm", right: "1cm", bottom: "1cm" },
landscape: true,
repeatHeaders: true,
template: $("#page-template").html(),
scale: 0.8
},
答案 0 :(得分:0)
出于安全原因,您无法访问本地文件夹。因此,不可能将您的导出本地文件夹作为目标。 考虑到您正在学习,Kendo还具有有趣的功能,用于保存文件的功能(服务器端)。 Here
这里是一个例子
var dataURI = "data:text/plain;base64,SGVsbG8gV29ybGQh";
kendo.saveAs({
dataURI: dataURI,
fileName: "test.txt",
proxyURL: "/path/to/proxy",
forceProxy: true
});