- 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();
}