Reported in Ticket ID: 1529288
Create an MVC application:
View:
@{
ViewBag.Title = "Home Page";
string sfile = System.IO.Path.Combine(Server.MapPath("~"), "File1.xlsx");
}
@Html.Kendo().Spreadsheet().Name("spreadsheet"))
<br />
<br />
<button class="k-button k-primary" id="export" onclick="ExportExcel()">Export Spreadsheet content</button>
<script>
function ExportExcel() {
var spread = $('#spreadsheet').getKendoSpreadsheet();
var data = JSON.stringify(spread.toJSON());
var fd = new FormData();
fd.append('wbook', data);
fd.append('sfile', "File1.xlsx");
$.ajax({
url: "@Url.Action("SaveFileExcel", "Home")",
data: fd,
contentType: "application/x-www-form-urlencoded",
processData: false,
contentType: false,
type: "POST",
statusCode: {
200: function (xhr, status, err) {
console.log('File exported!');
},
500: function (xhr, status, err) {
console.log('Internal Server Error!');
}
}
});
}
</script>
Controller:
[HttpPost]
public ActionResult SaveFileExcel(string wbook, string sFile)
{
var workbook = Telerik.Web.Spreadsheet.Workbook.FromJson(wbook);
string physicalPath = Path.Combine(Server.MapPath("~/"), sFile);
//workbook.Save("C:/inetpub/wwwroot/" + sFile
workbook.Save(physicalPath);
return new EmptyResult();
}
The Save method throws System.ExecutionEngineException
The file is saved.