Highlight Bindings In A Document
I have an Office Add-in using JavaScript API for Office 1.1. I am trying to highlight bindings in a Word document and bindings to cells in Excel documents so the user can easily re
Solution 1:
You have several options here. To highlighting with formatting, use the RangeFormat object to modify the outline, background, or other properties. Here's the code for a background fill:
Excel.run(function (ctx) {
var myRange = ctx.workbook.bindings.getItem("myBinding").getRange();
myRange.format.fill.color = "FFFF00";
return ctx.sync();
});
Alternatively, you can draw the user's attention by causing their selection to move to the binding:
Excel.run(function (ctx) {
var myRange = ctx.workbook.bindings.getItem("myBinding").getRange();
myRange.select();
return ctx.sync();
});
Finally, if you want the code above to work in Excel 2013 too, you can accomplish the same thing with this snippet:
var myDoc = Office.context.document;
myDoc.goToByIdAsync("myBinding", Office.GoToType.Binding, function (asyncResult) {});
-Michael Saunders, program manager for Office add-ins
Post a Comment for "Highlight Bindings In A Document"