2017-04-25 94 views
1

在我的加载项中,我们通过调用段落内的段落或段落内的搜索结果来导航文档。在最新版本的Word for iOS:2.0.2(170415)中,文档滚动到文档的正确部分,但文本不再突出显示。这是在以前发布的版本中使用的。选择不再突出显示iPad上的文字(字)

奇怪的是,如果我打开搜索栏,然后在我的文档周围浏览,文本确实会突出显示。

public SelectTextInstance(text: string, paragraphIndex: number, textInstance: number) { 
    Word.run(function (context) { 

     // Create a proxy object for the paragraphs collection. 
     var paragraphs = context.document.body.paragraphs; 

     context.load(paragraphs, 'text,font'); 

     return context.sync().then(function() { 

      if (paragraphIndex == -1) {//currently would occur for items that are inside of tables. 
       return; 
      } 

      var paragraph = paragraphs.items[paragraphIndex]; 

      return context.sync().then(function() { 
       var ranges = null; 
       //256 is the maximum length for a search item. Longer than this and we just have to select the paragraph. 
       if (text != undefined && text != null && text.length <= 256) { 
        ranges = paragraph.search(text, { matchCase: true, ignoreSpace: true}); 
        context.load(ranges, 'text'); 
       } 
       return context.sync().then(function() { 
        if (ranges == null || ranges.items.length == 0) { 
         paragraph.select(); 
        } 
        else { 
         //select the paragraph rather than overflow - something bad happened somewhere, so we'll fall back to highlighting the paragraph. 
         if (ranges.items.length <= textInstance) { 
          paragraph.select(); 
         } else { 
          ranges.items[textInstance].select(); 
         } 
        } 
        return context.sync().then(function() { 

        }); 

       }); 
      }); 
     }); 
    }) 
     .catch(function (error) { 
      console.log('Error: ' + JSON.stringify(error)); 
      if (error instanceof OfficeExtension.Error) { 
       console.log('Debug info: ' + JSON.stringify(error.debugInfo)); 
      } 
     }); 
} 
+0

既然它工作之前,它听起来像一个错误,但你可以添加你使用的代码? –

+0

我假设你沿着range.select()的方向使用某些东西;对吧? –

+0

是的。我已经在这里添加了我的代码供您查看。再次,这适用于Mac,Office Online,Word 2016,并且它在之前的ipad上完美运行。 –

回答

1

非常感谢您报告此问题。实际上,这是一种回归。范围被选中但没有着色。我们将推动下一次更新的修复。

+0

很高兴听到它。这不会导致我的验证测试失败吗?上周四我重新提交了我的应用。 –

+0

它不应该影响你的加载项提交 –

+0

我们已经有几次更新,因为这是报道,它仍然没有修复。任何想法,当我们可以期望它被解决? –