Free Support Forum - aspose.com

Cells.Find method not able to find the Cell in version 18.6.0

We are migrating from 7.6.1 to 18.6.0.0 for Aspose Cells. cells.Find method not able to find the cell based on Value.
I can see this is able to find based on StringValue but this is not our requirement.

Attaching the sample solution. SampleApplication.zip (3.8 MB)

@kumarabhishek06,

Thanks for your query.

Please share one sample Excel file which can be used to re-produce issue such that when we use it with old version 7.6.1 and latest version 18.8, it shall return different cell while searching with StringValue. It will help us to review the issue and provide our feedback.

@kumarabhishek06,

Well, this is not an issue with the product but expected behavior. Please note, if you want to find cell based on the displayed value (formatted value), you should use Cell.StringValue. For your information, Cell.Value attribute would give you the underlying value (unformatted value). In your case, the cell’s underlying value is different with formatted (displayed) value, see the screenshot for your reference:

For confirmation that it is not an issue with Aspose.Cells APIs, please open your template file into Ms Excel, now right-click on B3 cell to click “Format Cells” dialog box, then click “General” in the Category to see the underlying value.

Furthermore, if you still want to search based on the original values, kindly do change your sample code (see the line in bold) as following, it will as expected:
e.g
Sample code:

Workbook wb = new Workbook(“e:\test2\AP_MG_EMDLC_EXPOSURE_BYPART.xlsx”);
Worksheet wsRawData = wb.Worksheets[“RawData”];
wb.CalculateFormula();

        Cells cells = wsRawData.Cells;
        FindOptions findOptions = new FindOptions();
        findOptions.CaseSensitive = false;

findOptions.LookInType = LookInType.OriginalValues;

        CellArea ca = new CellArea();
        ca.StartRow = 4;
        ca.StartColumn = 1;
        ca.EndRow = 11;
        ca.EndColumn = 1;
        findOptions.SetRange(ca);


        
                 Cell foundCellByValue = cells.Find(wsRawData.Cells["B3"].Value, null, findOptions);