Description
Provide required information needed to triage your issue
When getting a document selection and performing a search
range.search('hello')
If there is only one instance of the search text in the document, Range.search returns a Range for the online version, but a RangeCollection for desktop. If there are multiple matches it correctly returns a RangeCollection, per the api documentation
Your Environment
- Platform [PC desktop, Mac, iOS, Office on the web]: Office on the web
- Host [Excel, Word, PowerPoint, etc.]: Word
- Office version number: latest
- Operating System: Mac
- Browser (if using Office on the web): Chrome
Expected behavior
I would expect that calling the Range.search method returns a RangeCollection both online and on desktop versions of the office js api.
Current behavior
Currently, in the online version of the office js api, Range.search returns a RangeCollection OR a Range (if there is only one match)
An improvement would be for it to always return a RangeCollection or note the different behavior on the web in the documentation
Steps to reproduce
- Using office on the web (Word) perform a search on a range (Range.search) for text that appears only once in the document
- await context.sync();
- log the result.
- see that it logs a Range, and not the expected RangeCollection
Link to live example(s)
Provide additional details
Context
Useful logs
- Console errors
- Screenshots
- Test file (if only happens on a particular file)
Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.