2017-04-25 95 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

我們已經有幾次更新,因爲這是報道,它仍然沒有修復。任何想法,當我們可以期望它被解決? –