Hi,
I am encountering an error while populating excel sheet and save it back to the server. There is no error when saving and populating excel with some excel file, but this issue is occurring on particular excel files only. Excel file is saved locally, where it is populated and saved it back to the same using syncfusion EJ2 spreadsheet. Please find the below screenshot.
This is my cshtml code.
@Html.EJS().Spreadsheet("spreadsheet").AllowEditing(true).AllowSave(true).OpenUrl("/Home/Open").SaveUrl("/Home/Save").Created("oncreated").Render();
</div>
<script>
function oncreated() {
try {
window.location.rel='nofollow' href = window.location.host;
var hf = '@ViewBag.filename';
if (hf !== null && hf !=='') {
var spread = ej.base.getComponent(document.getElementById('spreadsheet'), 'spreadsheet');
var req = new XMLHttpRequest();
req.responseType = 'blob';
req.onload = () => {
var file = new File([req.response], 'test.xlsx');
spread.open({ file: file });
}
req.open('get','/files/'+ hf);
req.send();
}
} catch (e) { console.log(e) };
};
function savetoserver() {
var spread = ej.base.getComponent(document.getElementById('spreadsheet'), 'spreadsheet');
spread.save();
};
Below is the excel populated with format error.
There are blank rows inserted wrongly which are not present in the original excel file.
Thanks