2017-06-16 79 views
0

我如何使用像我怎麼能使用一些東西一樣

var spreadsheet = $("#spreadsheet").data("kendoSpreadsheet"); 
spreadsheet.saveAsExcel(); 

一些東西保存Excel從劍道電子表格到遠程服務器保存從劍道電子表格的Excel到遠程服務器存儲擅長於客戶機上。

回答

0

您可以在Kendo SpreadSheetexcelExport事件中完成此操作。

使用下面的代碼:

excelExport: function(e) { 
    // Prevent the default behavior which will prompt the user to save the generated file. 
    e.preventDefault(); 

    // Get the Excel file as a data URL. 
    var dataURL = new kendo.ooxml.Workbook(e.workbook).toDataURL(); 

    // Strip the data URL prologue. 
    var base64 = dataURL.split(";base64,")[1]; 

    // Post the base64 encoded content to the server which can save it. 
    $.post("/server/save", { 
     base64: base64, 
     fileName: "ExcelExport.xlsx" 
    }); 
} 

可以劍道的文檔here進一步瞭解這一點。此頁面用於從Kendo Grid導出爲ex​​cel,但SpreadSheet完全相同。

+0

非常感謝@shai – JjE

+0

這個解決方案有效嗎? – Shai

+0

是的。 Byte [] bytes = Convert.FromBase64String(Base); File.WriteAllBytes(@「c:\」+ name,bytes); – JjE

相關問題