Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon Aug 06, 2018 7:10 pm

The following code throws an error when the second FindAllString(... method is called. The error is
Code: Select all
System.InvalidCastException: 'Unable to cast object of type 'Spire.Xls.CellRange[]' to type 'Spire.Xls.CellRange'.'


Can you tell me why I am not able to execute a FindAllString on a range?

Code: Select all
           
            using (var workbook = new Workbook())
            {
                workbook.LoadFromFile(@"c:\files\book4.xlsx");
                var sheet = workbook.Worksheets[0];
                var cells = sheet.FindAllString("{{", false, false);

                Console.WriteLine($"cell count: {cells.Length}");


                var cell2 = sheet.AllocatedRange.FindAllString("{{", false, false);
                Console.WriteLine($"cell count2: {cell2.Length}");


                var range = sheet.Range[1, 1, 8, 20];
                var cell3 = range.FindAllString("{{", false, false);
                Console.WriteLine($"cell count3: {cell3.Length}");


                Console.ReadLine();
            }

jsimmermon
 
Posts: 4
Joined: Wed May 23, 2018 10:56 pm

Tue Aug 07, 2018 8:01 am

Hello Jsimmermon,

Thanks for your letter.
I have reproduced the issue and logged it into our bug tracking system for investigating and fixing, if there is any update, we will let you know. Sorry for the inconvenience caused.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Fri Aug 31, 2018 8:52 am

Hello Jsimmermon,

Thanks for your patience.
Glad to inform you that the issue has been fixed in Spire.Office Platinum (DLL Only) Version:3.8.6.Welcome to test and any feedback will be greatly appreciated.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Thu Sep 13, 2018 7:42 am

Hello Jsimmermon,

Greetings from E-iceblue.
Has your issue been fixed with the updated version? Thanks in advance for your valuable feedback and time.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1261
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.XLS

cron