@Html.EJS().Spreadsheet("spreadsheet").Created("onCreated").OpenUrl("Home/Open").SaveUrl("Home/Save").Render()
<script>
function onCreated() {
var spreadsheetObj = ej.base.getComponent(document.getElementById('spreadsheet'), 'spreadsheet');
var request = new XMLHttpRequest();
request.responseType = "blob";
request.onload = () => {
var file = new File([request.response], "Sample1.xlsx");
spreadsheetObj.open({ file: file });
}
request.open("GET", "/Files/Sample1.xlsx"); // To Get the file from the URL
request.send();
}
</script> |
public ActionResult Open(OpenRequest openRequest)
{
return Content(Workbook.Open(openRequest));
} |
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer> |
<system.web>
<httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="put your invalid character here" />
</system.web> |