开发者

in the word using addin i want to redirect the image when click on image id but its showing error

in the word using addin i want to redirect the image when click on image id but its showing error

the error is shown in the attached image

hello every one please help me out with this i want to redirect the image when clicking on image id in the same document

  Office.context.document.addHandlerAsync(
    Office.EventType.DocumentSelectionChanged,
    (result:any) => {
      let bookmark = localStorage.getItem("bookmark")
      let bookmarkParse = JSON.parse(bookmark);
      console.log("bookmarkParse",bookmarkParse)
      bookmarkParse.map((item: any) => {
      Word.run(async (context) => {
        // var doc:any = context.document;
        console.log("result", result);
        const range :any = context.document.getSelection();            
        return context.sync().then(async function (){
          context.load(range);
          await context.sync();
          let text = range.text
          console.log("item", item.ImageId, text);      
          if (item.ImageId == text) {
            console.log("item bookmark",item.bookmark)               
            // range.hyperlink = "#" + item.bookmark;
            context.document.getSelection().hyperlink = `"#" + ${item.bookmark}`;
            return context.s开发者_Go百科ync();
          } else {
            console.log("range not matched");
          }              
          await context.sync();
        });           
      })
    })
    })

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜