in the word using addin i want to redirect the image when click on image id but its showing error
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();
});
})
})
})
精彩评论