Spreadsheet error dialog

0 Answers 61 Views
Spreadsheet
Jaspreet
Top achievements
Rank 1
Iron
Veteran
Jaspreet asked on 24 Jun 2021, 05:53 AM | edited on 19 Jul 2021, 02:09 PM

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

Ianko
Telerik team
commented on 28 Jun 2021, 10:16 AM

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? 

Ankur
Top achievements
Rank 1
commented on 28 Jun 2021, 12:26 PM

Actually When we are opening the xlsx file in the kendo spreadsheet this is giving the error that value of undefind in console. So we have checked in https://dojo.telerik.com/osEdEBeJ/2 url that is handling by the open the popup to show the error in file format or something else . can you please provide the implementation how you are handling the error for file format or some data issue
Ianko
Telerik team
commented on 30 Jun 2021, 05:05 AM

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

Jaspreet
Top achievements
Rank 1
Iron
Veteran
commented on 19 Jul 2021, 02:08 PM | edited

Hi Ianko, thanks for the reply. We tried testing a file in https://dojo.telerik.com/osEdEBeJ/2 . The file opens but does not load complete data and also the error dialog doesn't open. We checked excelImportErrors array is empty. I have added the file in the original question.
Ianko
Telerik team
commented on 22 Jul 2021, 05:22 AM

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.

Jaspreet
Top achievements
Rank 1
Iron
Veteran
commented on 19 Aug 2021, 10:33 AM

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

Ianko
Telerik team
commented on 23 Aug 2021, 08:25 AM

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. 

No answers yet. Maybe you can help?

Tags
Spreadsheet
Asked by
Jaspreet
Top achievements
Rank 1
Iron
Veteran
Share this question
or