Free Support Forum - aspose.com

Cells.FindString obsolete (I know that this question is like 6 years late)

So…you marked FindString as obsolete a long time ago, however I did not change our code, because to find out the “FindOptions” used by FindString is trial&error!
(I could not find any info on the matter at all)…

So - could you please tell me (and I am sure others are interested too) which FindOptions to use to 100% replicate the behavior of FindString?

(some stuff is easy to find out by trial&error: FindString was “CaseSensitive”, looked at “EntireContent” and looked at “Value”, however - other properties of FindOptions are either harder to find out by trial&error (the direction - I couldn’t be bothered to create test-excels just cause the documentation does not tell much)

Thanks in advance!

@jcolmsee,

Thanks for your query.

Please see the document for your reference:
https://docs.aspose.com/display/cellsnet/Find+or+Search+Data

See the sample code segment for your further reference, you should not set every option in FindOptions when using newer APIs:

// OLD CALL
Aspose.Cells.Cell chCell = cells.FindString(placeHolderName, prevCell);

//NEW CALL
e.g
Sample code:

............
FindOptions findOptions = new FindOptions();
            findOptions.CaseSensitive = true; //if you want it as case sensitive, otherwise set it to false
            findOptions.LookInType = LookInType.Values;
		findOptions.LookAtType = LookAtType.EntireContent;//you may change/set it accordingly
            .........

Aspose.Cells.Cell chCell = cells.Find(placeHolderName, prevCell, findOptions); 

If you still have any confusion or issue, kindly do paste your older code segment using FindString, we will help you on replacing it with newer/corresponding API.

So you say:
if I set:

  • CaseSensitive to “true”
  • LookInType = “Values”
  • LookAtType to “EntireContent”
  • leave the rest of FindOptions properties at the default value

I will have 100% replication of the old “FindString” behavior?

Thanks in advance

@jcolmsee,

Yes, it should work as per your expectations.

Should you find any issue or have any other query, feel free to write us back, we will be happy to assist you soon.

Thanks a lot.