'Bold Hebrew text in Microsoft Office Add-ins dosn't work
I try build some Office Add-in app to Highlight words in my text. I wrote this code but it does not bold Hebrew words, only English words. Any idea why?
Office.onReady((info) => {
if (info.host === Office.HostType.Word) {
document.getElementById("sideload-msg").style.display = "none";
document.getElementById("app-body").style.display = "flex";
document.getElementById("run").onclick = run;
}
});
async function highlightWord(word, context) {
var searchResults = context.document.body.search(word, { matchSuffix: true });
context.load(searchResults, "font");
await context.sync();
for (var i = 0; i < searchResults.items.length; i++) {
searchResults.items[i].font.color = "black";
searchResults.items[i].font.bold = true;//This line doesn't work with Hebrew.
searchResults.items[i].font.highlightColor = "yellow";
}
await context.sync();
}
export async function run() {
return Word.run(async (context) => {
var wordsArea = document.getElementById("wordsArea").value;
var words = wordsArea.split(" ");
for (var i = 0; i < words.length; i++) {
await highlightWord(words[i], context);
}
await context.sync();
});
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
