Aspose Cells gridweb is throwing InvalidCast Exception

Aspose Cells Gridweb is throwing below invalid cast exception when switching the sheets with one of our excel workbooks. One observation is, there is Cell that contains date, if we enter some date in that cell, then this exception is being thrown, if we empty that cell then the template is loading correctly on the GridWeb UI. We are not able to understand if some dependent cell causing the issue or which cell and which worksheet is creating the problem because of adding date to that cell.

Could you please help us to find out what was cell that is causing this cast exception?

image.png (61.7 KB)

@nagasivaos
hi,
We reviewed your photos and wanted to learn more.
Can you please share your sample file and sample code(runnable) code. This is very helpful for us to quickly analyze and solve your problem.

Aspose_Demo_RazorPages.zip (1.7 MB)

production_worksheet.zip (239.6 KB)

Attached is the solution and the sample file. in the sample file, if we remove date from cell BB6, then GridWeb is loading the workbook without any issue.

@nagasivaos
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSNET-55134

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

@nagasivaos
We will fix this issue in the next release. For this file, the temporary workaround code is below. After removing the date validation, it will be ok.

           GWExcelEditor.ImportExcelFile("C:\\Users\\peter\\Downloads\\production_worksheet.xlsx");
           GridValidationCollection vcs = GWExcelEditor.WorkSheets["NOTES & RATING"].Validations;
           for(int i= vcs.Count-1; i>=0;i--)
            {
                Console.WriteLine(i+"    validation info:  type:"+ vcs[i].ValidationType+ " , "+vcs[i].Formula1 +" "+ vcs[i].Formula2);
                ArrayList list = vcs[i].AreaList;
                foreach(GridCellArea area in list)
                {
                    Console.WriteLine(i + " area in validation " +area.StartRow+" "+area.StartColumn) ;
                }
                if(vcs[i].ValidationType==GridValidationType.Date)
                {
                    vcs.RemoveAt(i);
                    Console.WriteLine(i + " removed validation "  );
                }

            }

@nagasivaos,

This is to inform you that that your issue, logged as “CELLSNET-55134”, has been resolved. This fix/enhancement will be included in upcoming release (Aspose.Cells v24.3 package) that we plan to release in the first half of March (next month). You will be notified when the next version is released.

The issues you have found earlier (filed as CELLSNET-55134) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi