OfficeDev / office-js

A repo and NPM package for Office.js, corresponding to a copy of what gets published to the official "evergreen" Office.js CDN, at https://appsforoffice.microsoft.com/lib/1/hosted/office.js.
https://learn.microsoft.com/javascript/api/overview
Other
677 stars 95 forks source link

When using matchWildcards search in Word, the search API results and search box results appear differently #4992

Open anybody-1 opened 4 days ago

anybody-1 commented 4 days ago

Provide required information needed to triage your issue

When using matchWildcards search in Word, the search API results and search box results differently

Your Environment

Expected behavior

the text is four _ , i want to serach middle tow 's range set the document text is '__' , now i search '', the word app(windows/mac) normal search is two results([1,2], [3,4]), when i use advance search, it's tree results([1,2]|[2,3]|[3,4]). and when i search by api like `context.document.body.search("", { matchWildcards: true })`, it's two results([1,2][3,4]). i expect it's three results like word app advance search, because i want to find the range concat by second and three _

Current behavior

word search api return two results

Steps to reproduce

  1. set document text is '____'
  2. search "" by matchWildcards `Word.run(async (context) => { // Construct a wildcard expression and set matchWildcards to true in order to use wildcards. const results: Word.RangeCollection = context.document.body.search("", { matchWildcards: true }); results.load("length"); await context.sync(); console.log('results', results.items) await context.sync(); })`
  3. the console print is two results
microsoft-github-policy-service[bot] commented 4 days ago

Thank you for letting us know about this issue. We will take a look shortly. Thanks.

qinliuMSFT commented 4 days ago

Thank you for reporting this issue, I can repro it. It has been put on our backlog # 9469034, the team will investigate and we will reply to you as soon as there is any progress. Thank you for your patience.