Hi,
There are certain xlsx files that does not get open due to formatting done in the file. In latest version https://kendo.cdn.telerik.com/2021.2.616/js/kendo.all.min.js. tested in https://dojo.telerik.com/osEdEBeJ/2 , we saw a dialog showing the list of errors. Is this implemented as part of this release? As with the older versions https://kendo.cdn.telerik.com/2020.2.513/js/kendo.all.min.js , the dialog was not there and we could see error only in console.
When we integrated the scripts in actual application the dialog was not showing. Is there any specific way to open the error dialog?
Can we customize the error template?
Regards,
Jaspreet
Typically, the Import error dialogue is available since 5 years ago. Can you please provide a screenshot of the dialog you want to modify so that I can examine if there are built-in capabilities to do so?
The import error dialogue is shown via the Open Command when the import engine has logged errors:
kendo.spreadsheet.OpenCommand = Command.extend({
cannotUndo: true,
exec: function() {
var file = this.options.file;
if (file.name.match(/.xlsx$/i) === null) {
return { reason: "error", type: "openUnsupported" };
}
var workbook = this.options.workbook;
workbook.fromFile(this.options.file).then(function(){
var errors = workbook.excelImportErrors;
if (errors && errors.length) {
workbook._view.openDialog("importError", {
errors: errors
});
}
});
}
});
If the requirement is to validate and get what exactly is the error with the file imported you can download an OOXML validator and see the errors available. For example: https://archive.codeplex.com/?p=ooxmlvalidator.
I checked the uploaded file and opening it as it indeed does not show some data. However, opening the same in Excel prompts a save dialogue on closing which means that there are some fixed issues with the document. Opening the newly saved document opens properly in the Spreadsheet.
If the file is generated, make sure to validate it with an OpenXML tool/utility to ensure that the generation is proper. You can check this MSDN article: https://social.msdn.microsoft.com/Forums/office/en-US/cc47ab65-dab7-4e32-b676-b641aa1e1411/how-to-validate-the-xlsx-that-i-generate?forum=oxmlsdk.
hi Ianko,
I have test a file using tool- OpenXMLSDKToolV25 from https://web.archive.org/web/20190116000204/https://www.microsoft.com/en-us/download/details.aspx?id=30425 , it shows the excel file as valid, but still when the file is loaded in spreadsheet viewer it does not show complete data.
how to handle this kind of scenarios?
Regards,
Jaspreet
Hi Jaspreet,
Have you tried opening it in Excel? Does the save dialogue prompts due to errors? If that happens, then the file most probably still has errors.