javascript - Highlight bindings in a document -


i have office add-in using javascript api office 1.1. trying highlight bindings in word document , bindings cells in excel documents user can recognize them.

i see api allows formatting of tablebindings using setformatsasync mine matrix , text. don't use table type because adds header row , total row messes logic.

is there way format or highlight bindings?

i prefer temporary - similar way background color changes bit when hover on top of binding can live coloring text , removing color.

you have several options here. highlighting formatting, use rangeformat object modify outline, background, or other properties. here's code background fill:

excel.run(function (ctx) {      var myrange = ctx.workbook.bindings.getitem("mybinding").getrange();     myrange.format.fill.color = "ffff00";     return ctx.sync();  }); 

alternatively, can draw user's attention causing selection move binding:

excel.run(function (ctx) {      var myrange = ctx.workbook.bindings.getitem("mybinding").getrange();     myrange.select();     return ctx.sync();  }); 

finally, if want code above work in excel 2013 too, can accomplish same thing snippet:

var mydoc = office.context.document; mydoc.gotobyidasync("mybinding", office.gototype.binding, function (asyncresult) {}); 

-michael saunders, program manager office add-ins


Comments