Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150423 | Jan 6,2020 11:58 PM UTC | Jan 17,2020 10:51 AM UTC | ASP.NET MVC - EJ 2 | 11 |
![]() |
Tags: Spreadsheet |
@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> |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.